[Python-ideas] venv *is* provided in the standard Python install on Debian/Ubuntu

Nick Coghlan ncoghlan at gmail.com
Sun Nov 12 21:32:06 EST 2017


On 13 November 2017 at 04:38, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Sun, 12 Nov 2017 12:20:45 +0000
> Paul Moore <p.f.moore at gmail.com> wrote:
>>
>> > Well, not exactly. Do you do python -m venv, or py -x.x -m venv or
>> > pythonx -m venv ? Wait, it's not installed by default on debian.
>>
>> Seriously? Debian don't provide venv in the standard Python install?
>> That's just broken.
>
> Frankly, I don't know where the current discussion comes from, but on
> two recent Debian and Ubuntu setups, I get:
>
> $ dpkg -S /usr/lib/python3.5/venv/__init__.py
> libpython3.5-stdlib:amd64: /usr/lib/python3.5/venv/__init__.py

The discussion comes from the fact that even though the code is
present it doesn't actually work:

$ docker run --rm -it ncoghlan/debian-python bash
root at e9c0aa482aeb:/# python3 -m venv test_venv
Error: Command '['/test_venv/bin/python3', '-Im', 'ensurepip',
'--upgrade', '--default-pip']' returned non-zero exit status 1

(I just refreshed my Docker image to 9.2, so that's the current
default behaviour after "apt-get install -y python3")

So technically it's ensurepip that's broken by default, but that
translates to venv also being broken by default.

I haven't worked out what the actual steps needed to fix it are (but I
do know that installing "python3-pip" isn't enough the way it is on
Fedora - we reconcile ensurepip with our security management policies
by having a Recommends dep from python3 to python3-pip, and then
patching ensurepip to use rewheel to inject a copy of the system pip
into freshly created virtual environments. At least in theory, Debian
should be able to do something similar with dirtbike, but whether or
not they actually will would be a question for Matthias Klose as the
Debian Python maintainer).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list