Debian Bug report logs -
#901803
python3-venv: Cannot create new virtual environments anymore
Reported by: Bastian Venthur <venthur@debian.org>
Date: Mon, 18 Jun 2018 14:33:01 UTC
Severity: important
Found in version python3-defaults/3.6.5-3
Done: Matthias Klose <doko@debian.org>
Reply or subscribe to this bug.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#901803; Package python3-venv.
(Mon, 18 Jun 2018 14:33:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Bastian Venthur <venthur@debian.org>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>.
(Mon, 18 Jun 2018 14:33:04 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: python3-venv
Version: 3.6.5-3
Severity: important
Dear Maintainer,
Recently I cannot create new virtual environments anymore:
```bash
$ python3 -m venv venv
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/venv/bin/python3', '-Im', 'ensurepip',
'--upgrade', '--default-pip']
```
However I have python3-venv installed:
```bash
$ dpkg -l python3-venv
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture
Description
+++-==============================-====================-============
ii python3-venv 3.6.5-3 amd64
pyvenv-3 binary for python3 (default python3 version)
```
Cheers,
Bastian
-- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.16.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages python3-venv depends on:
ii python3 3.6.5-3
ii python3-distutils 3.6.6~rc1-3
ii python3.6-venv 3.6.6~rc1-1
python3-venv recommends no packages.
python3-venv suggests no packages.
-- no debconf information
--
Dr. Bastian Venthur http://venthur.de
Debian Developer venthur at debian org
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#901803; Package python3-venv.
(Mon, 18 Jun 2018 15:45:07 GMT) (full text, mbox, link).
Acknowledgement sent
to Simon Heath <snheath@gmail.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Mon, 18 Jun 2018 15:45:07 GMT) (full text, mbox, link).
Message #10 received at 901803@bugs.debian.org (full text, mbox, reply):
I have this bug too. Did some digging, the error message is wrong due
to over-zealous assumptions.
In /usr/lib/python3.6/venv/__init__.py:
def _setup_pip(self, context):
"""Installs or upgrades pip in a virtual environment"""
# We run ensurepip in isolated mode to avoid side effects from
# environment vars, the current directory and anything else
# intended for the global Python environment
cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade',
'--default-pip']
# Debian 2015-09-18 barry@debian.org: <python>-venv is a
separate
# binary package which might not be installed. In that case,
the
# following command will produce an unhelpful error. Let's
make it
# more user friendly.
try:
subprocess.check_output(
cmd, stderr=subprocess.STDOUT,
universal_newlines=True)
except subprocess.CalledProcessError:
print(...)
So any failure in the command will invoke the error message.
Trying to call the command line given by the `cmd` variable directly
gets me this:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.6/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/usr/lib/python3.6/ensurepip/__init__.py", line 264, in _main
default_pip=args.default_pip,
File "/usr/lib/python3.6/ensurepip/__init__.py", line 176, in
_bootstrap
return _run_pip(args + _PROJECTS, additional_paths)
File "/usr/lib/python3.6/ensurepip/__init__.py", line 54, in _run_pip
import pip._internal
ModuleNotFoundError: No module named 'pip._internal'
Looking at /usr/lib/python3.6/ensurepip/__init__.py we see:
def _run_pip(args, additional_paths=None):
# Add our bundled software to the sys.path so we can import it
if additional_paths is not None:
sys.path = additional_paths + sys.path
# Install the bundled software
import pip._internal
return pip._internal.main(args)
Rummaging through /usr/lib/python3/dist-packages/pip/ I don't find an
`_internal` package but I do find a `pip.main()` method, so I just
change the `_run_pip()` function to call that:
def _run_pip(args, additional_paths=None):
# Add our bundled
software to the sys.path so we can import it
if additional_paths is
not None:
sys.path = additional_paths + sys.path
# Install the bundled software
import pip
return pip.main(args)
And everything APPEARS to work with this ugly hack.
Love,
Simon
Reply sent
to Matthias Klose <doko@debian.org>:
You have taken responsibility.
(Fri, 22 Jun 2018 08:03:08 GMT) (full text, mbox, link).
Notification sent
to Bastian Venthur <venthur@debian.org>:
Bug acknowledged by developer.
(Fri, 22 Jun 2018 08:03:08 GMT) (full text, mbox, link).
Message #15 received at 901803-done@bugs.debian.org (full text, mbox, reply):
this is fixed in python3.6-venv in unstable.
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Sun Jul 1 09:20:02 2018;
Machine Name:
buxtehude
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.