Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #13246 > unrolled thread

Need a Python 3.8 virtual environment

Started bySteven Robbins <steve@sumost.ca>
First post2021-03-03 04:30 +0100
Last post2021-03-03 20:00 +0100
Articles 14 — 11 participants

Back to article view | Back to linux.debian.maint.python


Contents

  Need a Python 3.8 virtual environment Steven Robbins <steve@sumost.ca> - 2021-03-03 04:30 +0100
    Re: Need a Python 3.8 virtual environment Jerome Kieffer <Jerome.Kieffer@esrf.fr> - 2021-03-03 08:00 +0100
    Re: Need a Python 3.8 virtual environment Andrey Rahmatullin <wrar@debian.org> - 2021-03-03 08:20 +0100
    Re: Need a Python 3.8 virtual environment Pokoradi Balazs <pokoradi.1899@gmail.com> - 2021-03-03 09:00 +0100
    Re: Need a Python 3.8 virtual environment Nicolas Chauvat <nicolas.chauvat@logilab.fr> - 2021-03-03 10:10 +0100
    Re: Need a Python 3.8 virtual environment Julien Palard <julien@palard.fr> - 2021-03-03 11:50 +0100
      Re: Need a Python 3.8 virtual environment Jeremy Stanley <fungi@yuggoth.org> - 2021-03-03 15:00 +0100
      Re: Need a Python 3.8 virtual environment Steven Robbins <steve@sumost.ca> - 2021-03-04 04:50 +0100
    Re: Need a Python 3.8 virtual environment Yaroslav Halchenko <debian@onerussian.com> - 2021-03-03 14:40 +0100
      Re: Need a Python 3.8 virtual environment Andrey Rahmatullin <wrar@debian.org> - 2021-03-03 14:40 +0100
    Re: Need a Python 3.8 virtual environment Stefano Rivera <stefanor@debian.org> - 2021-03-03 18:40 +0100
      Re: Need a Python 3.8 virtual environment Andrey Rahmatullin <wrar@debian.org> - 2021-03-03 19:00 +0100
        Re: Need a Python 3.8 virtual environment Matthias Klose <doko@debian.org> - 2021-03-03 19:10 +0100
    Re: Need a Python 3.8 virtual environment Karthik <karthikgatiganti@gmail.com> - 2021-03-03 20:00 +0100

#13246 — Need a Python 3.8 virtual environment

FromSteven Robbins <steve@sumost.ca>
Date2021-03-03 04:30 +0100
SubjectNeed a Python 3.8 virtual environment
Message-ID<BOqmZ-3IX-1@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi,

I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's 
default is currently 3.9 so I am advised to use a virtual environment.   Being 
a newbie, I searched around and found a writeup covering several different 
virtualization tools [1].   Note I am using Debian 'sid'.

I can use the tool "virtualenv" to create a virtual environment for default 
python:

steve@riemann:/tmp$ virtualenv blah
created virtual environment CPython3.9.1.final.0-64 in 77ms
  creator CPython3Posix(dest=/tmp/blah, clear=False, no_vcs_ignore=False, 
global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, 
wheel=bundle, via=copy, app_data_dir=/home/steve/.local/share/virtualenv)
    added seed packages: pip==20.1.1, pkg_resources==0.0.0, 
setuptools==44.0.0, wheel==0.34.2
  activators 
BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator


But not for python 3.8:

steve@riemann:/tmp$ virtualenv -p python3.8 blah38
RuntimeError: failed to find interpreter for Builtin discover of 
python_spec='python3.8'


I have installed literally all the Debian python packages whose name contains 
'python3.8'.   A very short list:

ii  libpython3.8:amd64                            3.8.7-1                         
amd64        Shared Python runtime library (version 3.8)
ii  libpython3.8-dev:amd64                        3.8.7-1                         
amd64        Header files and a static library for Python (v3.8)
ii  libpython3.8-minimal:amd64                    3.8.7-1                         
amd64        Minimal subset of the Python language (version 3.8)
ii  libpython3.8-stdlib:amd64                     3.8.7-1                         
amd64        Interactive high-level object-oriented language (standard 
library, version 3.8)
ii  python3.8                                     3.8.7-1                         
amd64        Interactive high-level object-oriented language (version 3.8)
ii  python3.8-dev                                 3.8.7-1                         
amd64        Header files and a static library for Python (v3.8)
ii  python3.8-minimal   



I have also tried the module 'venv':

steve@riemann:/tmp$ python3.8 -m venv v38
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/tmp/v38/bin/python3.8', '-Im', 'ensurepip', '--upgrade', 
'--default-pip']

steve@riemann:/tmp$ python3.8 -m venv blah38
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/tmp/blah38/bin/python3.8', '-Im', 'ensurepip', '--
upgrade', '--default-pip']


Note that I do have 'python3-venv' installed, but it is the 3.9 version:
ii  python3-venv                                  3.9.1-1                         
amd64        pyvenv-3 binary for python3 (default python3 version)


Is there something I've missed?  

Thank you,
-Steve

[1] https://linuxconfig.org/how-to-set-up-a-python-virtual-environment-on-debian-10-buster

[toc] | [next] | [standalone]


#13247

FromJerome Kieffer <Jerome.Kieffer@esrf.fr>
Date2021-03-03 08:00 +0100
Message-ID<BOtEf-5zs-9@gated-at.bofh.it>
In reply to#13246
On Tue, 02 Mar 2021 21:17:36 -0600
Steven Robbins <steve@sumost.ca> wrote:

> Hi,
> 
> I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's 
> default is currently 3.9 so I am advised to use a virtual environment.   Being 
> a newbie, I searched around and found a writeup covering several different 
> virtualization tools [1].   Note I am using Debian 'sid'.
[...]
> Is there something I've missed?  


Hi Steven,

I don't think there is any simple solution for you within the debian ecosystem.
As a developper, I faced the same issue and ended in installing `conda` to
have a quick access to the various python versions (then I create
some venv from the conda environments).

I doubt our use-case is common enough to justify having multiple python (again) in Debian.

Cheers,

Jerome

PS: venv are about 10x smaller than conda environments !

[toc] | [prev] | [next] | [standalone]


#13248

FromAndrey Rahmatullin <wrar@debian.org>
Date2021-03-03 08:20 +0100
Message-ID<BOtXz-5WJ-1@gated-at.bofh.it>
In reply to#13246

[Multipart message — attachments visible in raw view] — view raw

It looks like the only sane way to use non-default Python versions is to
build them locally using pyenv. 

-- 
WBR, wRAR

[toc] | [prev] | [next] | [standalone]


#13249

FromPokoradi Balazs <pokoradi.1899@gmail.com>
Date2021-03-03 09:00 +0100
Message-ID<BOuAh-68R-1@gated-at.bofh.it>
In reply to#13246

[Multipart message — attachments visible in raw view] — view raw

Hi Steven,

i tested in a freshly installed virtualbox machine and was able to 
create a virtual environment, using the following steps:

built python3.8.7 form tarball 
(|https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tar.xz)|

ran python3.8 -m venv test387

and then could activate it.

I hope this helps,

Balazs

On 03/03/2021 03:17, Steven Robbins wrote:
> Hi,
>
> I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's
> default is currently 3.9 so I am advised to use a virtual environment.   Being
> a newbie, I searched around and found a writeup covering several different
> virtualization tools [1].   Note I am using Debian 'sid'.
>
> I can use the tool "virtualenv" to create a virtual environment for default
> python:
>
> steve@riemann:/tmp$ virtualenv blah
> created virtual environment CPython3.9.1.final.0-64 in 77ms
>    creator CPython3Posix(dest=/tmp/blah, clear=False, no_vcs_ignore=False,
> global=False)
>    seeder FromAppData(download=False, pip=bundle, setuptools=bundle,
> wheel=bundle, via=copy, app_data_dir=/home/steve/.local/share/virtualenv)
>      added seed packages: pip==20.1.1, pkg_resources==0.0.0,
> setuptools==44.0.0, wheel==0.34.2
>    activators
> BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
>
>
> But not for python 3.8:
>
> steve@riemann:/tmp$ virtualenv -p python3.8 blah38
> RuntimeError: failed to find interpreter for Builtin discover of
> python_spec='python3.8'
>
>
> I have installed literally all the Debian python packages whose name contains
> 'python3.8'.   A very short list:
>
> ii  libpython3.8:amd64                            3.8.7-1
> amd64        Shared Python runtime library (version 3.8)
> ii  libpython3.8-dev:amd64                        3.8.7-1
> amd64        Header files and a static library for Python (v3.8)
> ii  libpython3.8-minimal:amd64                    3.8.7-1
> amd64        Minimal subset of the Python language (version 3.8)
> ii  libpython3.8-stdlib:amd64                     3.8.7-1
> amd64        Interactive high-level object-oriented language (standard
> library, version 3.8)
> ii  python3.8                                     3.8.7-1
> amd64        Interactive high-level object-oriented language (version 3.8)
> ii  python3.8-dev                                 3.8.7-1
> amd64        Header files and a static library for Python (v3.8)
> ii  python3.8-minimal
>
>
>
> I have also tried the module 'venv':
>
> steve@riemann:/tmp$ python3.8 -m venv v38
> The virtual environment was not created successfully because ensurepip is not
> available.  On Debian/Ubuntu systems, you need to install the python3-venv
> package using the following command.
>
>      apt-get install python3-venv
>
> You may need to use sudo with that command.  After installing the python3-venv
> package, recreate your virtual environment.
>
> Failing command: ['/tmp/v38/bin/python3.8', '-Im', 'ensurepip', '--upgrade',
> '--default-pip']
>
> steve@riemann:/tmp$ python3.8 -m venv blah38
> The virtual environment was not created successfully because ensurepip is not
> available.  On Debian/Ubuntu systems, you need to install the python3-venv
> package using the following command.
>
>      apt-get install python3-venv
>
> You may need to use sudo with that command.  After installing the python3-venv
> package, recreate your virtual environment.
>
> Failing command: ['/tmp/blah38/bin/python3.8', '-Im', 'ensurepip', '--
> upgrade', '--default-pip']
>
>
> Note that I do have 'python3-venv' installed, but it is the 3.9 version:
> ii  python3-venv                                  3.9.1-1
> amd64        pyvenv-3 binary for python3 (default python3 version)
>
>
> Is there something I've missed?
>
> Thank you,
> -Steve
>
> [1] https://linuxconfig.org/how-to-set-up-a-python-virtual-environment-on-debian-10-buster

[toc] | [prev] | [next] | [standalone]


#13250

FromNicolas Chauvat <nicolas.chauvat@logilab.fr>
Date2021-03-03 10:10 +0100
Message-ID<BOvG1-70p-1@gated-at.bofh.it>
In reply to#13246
Hi Steven,

On Tue, Mar 02, 2021 at 09:17:36PM -0600, Steven Robbins wrote:

> I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's 
> ...
> Is there something I've missed?  

Do you know https://github.com/saghul/pythonz ?

I do not use it myself, but a colleague told me he uses that when he
needs to test something with every python version available.

Hope this helps.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  

[toc] | [prev] | [next] | [standalone]


#13251

FromJulien Palard <julien@palard.fr>
Date2021-03-03 11:50 +0100
Message-ID<BOxeN-7Nc-1@gated-at.bofh.it>
In reply to#13246
Le 2021-03-03 à 04:17, Steven Robbins a écrit :
> I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's
> default is currently 3.9 so I am advised to use a virtual environment.

As other  told, the right way is probably to compile it yourself (or use
pyenv, but I don't like pyenv "shims", I prefer to keep it simple).

I'm using a bash function [1] to easily recompile needed Pythons (I test
some projects with Python 3.5 to 3.9), but it's not that hard without my
bash function:

     apt install make build-essential libbz2-dev liblzma-dev libssl-dev
llvm libreadline-dev libncurses5-dev libffi-dev zlib1g-dev tk-dev
libsqlite3-dev xz-utils
     wget the version you want from https://www.python.org/ftp/python
     tar -xzf it
     ./configure --prefix=$HOME/.local/
     make -j $(nproc)
     make altinstall

You'll get a `python3.8` binary in ~/.local/bin, you can create venvs
with it as:

     python3.8 -m venv the_venv_path

[1]:
https://github.com/JulienPalard/dotfiles/blob/0b5feb79b1ba648b7212162b68da5a182e0341c1/.bashrc#L196
--
[Julien Palard](https://mdk.fr)

[toc] | [prev] | [next] | [standalone]


#13255

FromJeremy Stanley <fungi@yuggoth.org>
Date2021-03-03 15:00 +0100
Message-ID<BOAcF-16N-5@gated-at.bofh.it>
In reply to#13251

[Multipart message — attachments visible in raw view] — view raw

On 2021-03-03 10:45:46 +0000 (+0000), Julien Palard wrote:
[...]
> I'm using a bash function [1] to easily recompile needed Pythons (I test
> some projects with Python 3.5 to 3.9), but it's not that hard without my
> bash function:
[...]

This is pretty much identical to how I tackle it too, though I build
from tags checked out of the cpython Git repository.

If you're looking for prebuilt debs, I know some folks use this,
from what I understand the packages should be compatible with
reasonably contemporary Debian releases:

    https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa

-- 
Jeremy Stanley

[toc] | [prev] | [next] | [standalone]


#13267

FromSteven Robbins <steve@sumost.ca>
Date2021-03-04 04:50 +0100
Message-ID<BON9T-184-3@gated-at.bofh.it>
In reply to#13251

[Multipart message — attachments visible in raw view] — view raw

Thank you so much to the many folks on debian-python who responded with 
instructions and pointers!

On Wednesday, March 3, 2021 4:45:46 A.M. CST Julien Palard wrote:

> As other  told, the right way is probably to compile it yourself (or use
> pyenv, but I don't like pyenv "shims", I prefer to keep it simple).

Thank you for the detailed instructions!  I used this method to build python 
myself and now I have the virtual environment set up.

Regards,
-Steve

[toc] | [prev] | [next] | [standalone]


#13253

FromYaroslav Halchenko <debian@onerussian.com>
Date2021-03-03 14:40 +0100
Message-ID<BOzTk-10r-5@gated-at.bofh.it>
In reply to#13246
On Tue, 02 Mar 2021, Steven Robbins wrote:

> Hi,

> I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's 
> default is currently 3.9 so I am advised to use a virtual environment.   Being 
> a newbie, I searched around and found a writeup covering several different 
> virtualization tools [1].   Note I am using Debian 'sid'.

I know that it is not a "proper" Debian answer, but in such cases I just
quickly install miniconda with a needed python version.  I keep a
miniconda installation with conda environments for different Pythons
for such cases.

-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
WWW:   http://www.linkedin.com/in/yarik        

[toc] | [prev] | [next] | [standalone]


#13254

FromAndrey Rahmatullin <wrar@debian.org>
Date2021-03-03 14:40 +0100
Message-ID<BOzTk-10r-3@gated-at.bofh.it>
In reply to#13253

[Multipart message — attachments visible in raw view] — view raw

On Wed, Mar 03, 2021 at 08:32:01AM -0500, Yaroslav Halchenko wrote:
> > I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's 
> > default is currently 3.9 so I am advised to use a virtual environment.   Being 
> > a newbie, I searched around and found a writeup covering several different 
> > virtualization tools [1].   Note I am using Debian 'sid'.
> 
> I know that it is not a "proper" Debian answer
Sure, the only proper Debian answer would be "actually you don't need this
version".

-- 
WBR, wRAR

[toc] | [prev] | [next] | [standalone]


#13256

FromStefano Rivera <stefanor@debian.org>
Date2021-03-03 18:40 +0100
Message-ID<BODDA-3fE-3@gated-at.bofh.it>
In reply to#13246
Hi Steven (2021.03.03_03:17:36_+0000)
> steve@riemann:/tmp$ python3.8 -m venv blah38
> The virtual environment was not created successfully because ensurepip is not
> available.  On Debian/Ubuntu systems, you need to install the python3-venv
> package using the following command.
> 
>     apt-get install python3-venv
> 
> You may need to use sudo with that command.  After installing the python3-venv
> package, recreate your virtual environment.
> 
> Failing command: ['/tmp/blah38/bin/python3.8', '-Im', 'ensurepip', '--
> upgrade', '--default-pip']
> 
> 
> Note that I do have 'python3-venv' installed, but it is the 3.9 version:
> ii  python3-venv                                  3.9.1-1                         
> amd64        pyvenv-3 binary for python3 (default python3 version)
> 
> 
> Is there something I've missed?  

You need python3.8-venv. But even then you may run into a
missing/incompatible distutils (#979819):
https://bugs.debian.org/979819

You can see if you have, by running the failing ensurepip command by
hand.

Hopefully we'll make that situation better soon...

BTW: There's a deadsnakes-like archive for Debian:
https://people.debian.org/~paravoid/python-all/

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272

[toc] | [prev] | [next] | [standalone]


#13257

FromAndrey Rahmatullin <wrar@debian.org>
Date2021-03-03 19:00 +0100
Message-ID<BODWW-3wd-9@gated-at.bofh.it>
In reply to#13256

[Multipart message — attachments visible in raw view] — view raw

On Wed, Mar 03, 2021 at 05:39:04PM +0000, Stefano Rivera wrote:
> You need python3.8-venv. 
Which doesn't exist, at least in the current repos.

-- 
WBR, wRAR

[toc] | [prev] | [next] | [standalone]


#13258

FromMatthias Klose <doko@debian.org>
Date2021-03-03 19:10 +0100
Message-ID<BOE6C-3PC-7@gated-at.bofh.it>
In reply to#13257
On 3/3/21 6:56 PM, Andrey Rahmatullin wrote:
> On Wed, Mar 03, 2021 at 05:39:04PM +0000, Stefano Rivera wrote:
>> You need python3.8-venv. 
> Which doesn't exist, at least in the current repos.

you rebuild it from python3-stdlib-extensions. but yes, the binaries don't exist
in the archive.

[toc] | [prev] | [next] | [standalone]


#13259

FromKarthik <karthikgatiganti@gmail.com>
Date2021-03-03 20:00 +0100
Message-ID<BOET0-48b-5@gated-at.bofh.it>
In reply to#13246
On Wed, Mar 3, 2021 at 8:56 AM Steven Robbins <steve@sumost.ca> wrote:
>
> Hi,
>
> I'm trying to use a (non-Debian) python system built on python 3.8.  Debian's
> default is currently 3.9 so I am advised to use a virtual environment.   Being
> a newbie, I searched around and found a writeup covering several different
> virtualization tools [1].   Note I am using Debian 'sid'.
>
> I can use the tool "virtualenv" to create a virtual environment for default
> python:
>
> steve@riemann:/tmp$ virtualenv blah
> created virtual environment CPython3.9.1.final.0-64 in 77ms
>   creator CPython3Posix(dest=/tmp/blah, clear=False, no_vcs_ignore=False,
> global=False)
>   seeder FromAppData(download=False, pip=bundle, setuptools=bundle,
> wheel=bundle, via=copy, app_data_dir=/home/steve/.local/share/virtualenv)
>     added seed packages: pip==20.1.1, pkg_resources==0.0.0,
> setuptools==44.0.0, wheel==0.34.2
>   activators
> BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
>
>
> But not for python 3.8:
>
> steve@riemann:/tmp$ virtualenv -p python3.8 blah38
> RuntimeError: failed to find interpreter for Builtin discover of
> python_spec='python3.8'
>
>
> I have installed literally all the Debian python packages whose name contains
> 'python3.8'.   A very short list:
>
> ii  libpython3.8:amd64                            3.8.7-1
> amd64        Shared Python runtime library (version 3.8)
> ii  libpython3.8-dev:amd64                        3.8.7-1
> amd64        Header files and a static library for Python (v3.8)
> ii  libpython3.8-minimal:amd64                    3.8.7-1
> amd64        Minimal subset of the Python language (version 3.8)
> ii  libpython3.8-stdlib:amd64                     3.8.7-1
> amd64        Interactive high-level object-oriented language (standard
> library, version 3.8)
> ii  python3.8                                     3.8.7-1
> amd64        Interactive high-level object-oriented language (version 3.8)
> ii  python3.8-dev                                 3.8.7-1
> amd64        Header files and a static library for Python (v3.8)
> ii  python3.8-minimal
>
>
>
> I have also tried the module 'venv':
>
> steve@riemann:/tmp$ python3.8 -m venv v38
> The virtual environment was not created successfully because ensurepip is not
> available.  On Debian/Ubuntu systems, you need to install the python3-venv
> package using the following command.
>
>     apt-get install python3-venv
>
> You may need to use sudo with that command.  After installing the python3-venv
> package, recreate your virtual environment.
>
> Failing command: ['/tmp/v38/bin/python3.8', '-Im', 'ensurepip', '--upgrade',
> '--default-pip']
>
> steve@riemann:/tmp$ python3.8 -m venv blah38
> The virtual environment was not created successfully because ensurepip is not
> available.  On Debian/Ubuntu systems, you need to install the python3-venv
> package using the following command.
>
>     apt-get install python3-venv
>
> You may need to use sudo with that command.  After installing the python3-venv
> package, recreate your virtual environment.
>
> Failing command: ['/tmp/blah38/bin/python3.8', '-Im', 'ensurepip', '--
> upgrade', '--default-pip']
>
>
> Note that I do have 'python3-venv' installed, but it is the 3.9 version:
> ii  python3-venv                                  3.9.1-1
> amd64        pyvenv-3 binary for python3 (default python3 version)
>
>
> Is there something I've missed?
>
> Thank you,
> -Steve
>
> [1] https://linuxconfig.org/how-to-set-up-a-python-virtual-environment-on-debian-10-buster


try using pyenv
https://mentors.debian.net/package/pyenv/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.maint.python


csiph-web