venv creation fails: ensurepip error
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| python3.9 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
Tested on focal with both the focal-proposed 3.9.0-1~20.04 amd64 and focal-updates 3.9.0~rc1-1~20.04 amd64 packages.
Installed python3.9 (+deps) and python3.9-venv
$ python3.9 -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: ['/home/
$ python3.9 -m ensurepip --version
/usr/bin/python3.9: Error while finding module specification for 'ensurepip.
vs:
$ python3.8 -m ensurepip --version
pip 20.0.2
Adding --without-pip works to create the venv, but obviously without pip.
Comparing /usr/lib/
By commenting out:
from . import _bundled
everything works fine. venv creates/activates using the common wheels made available from python 3.8 (unless the same old versions are also being bundled with 3.9?) to create the venv with --upgrade-deps so that it'll take on current versions instead.
Of course, this relies on having the wheels available (didn't check if 3.9 also includes these wheels or if they're pre-existing from 3.8) and having them be compatible (they target py2.py3 so this should be fine).
$ python3.9 -m venv --upgrade-deps venv
Collecting pip
Downloading pip-20.
|█
Collecting setuptools
Downloading setuptools-
|█
Installing collected packages: pip, setuptools
Attempting uninstall: pip
Found existing installation: pip 20.0.2
Uninstalling pip-20.0.2:
Successfully uninstalled pip-20.0.2
Attempting uninstall: setuptools
Found existing installation: setuptools 44.0.0
Uninstalling setuptools-44.0.0:
Successfully uninstalled setuptools-44.0.0
Successfully installed pip-20.2.3 setuptools-50.3.1
ziddey@
(venv) ziddey@
Package Version
------------- -------
pip 20.2.3
pkg-resources 0.0.0
setuptools 50.3.1
| description: | updated |
| Changed in python3.9 (Ubuntu): | |
| status: | Confirmed → Fix Released |

Status changed to 'Confirmed' because the bug affects multiple users.