python3.8-venv should depend on python3-distutils

Bug #1851684 reported by Anthony Sottile on 2019-11-07
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
python3.8 (Ubuntu)
Undecided
Unassigned

Bug Description

Originally reported here: https://github.com/deadsnakes/issues/issues/97

I'm also surprised to see a package added to LTS so late in the game, is there a change in policy around new packages / feature bumps that I missed?

Here's a reproduction using docker:

```
FROM ubuntu:bionic
RUN apt-get update && apt-get install -yq python3.8-venv
RUN python3.8 -m venv /venv
```

```
Step 3/3 : RUN python3.8 -m venv /venv
 ---> Running in 41a792e03c49
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: ['/venv/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

The command '/bin/sh -c python3.8 -m venv /venv' returned a non-zero code: 1
```

The inner (hidden) error:

```
root@f806220c24ec:/# python3.8 -mvenv /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: ['/venv/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

root@f806220c24ec:/# /venv/bin/python -m ensurepip
Traceback (most recent call last):
  File "/usr/lib/python3.8/ensurepip/__init__.py", line 54, in _run_pip
    import pip._internal
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmpmmf52da_/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 29, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmpmmf52da_/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 23, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/tmpmmf52da_/pip-9.0.1-py2.py3-none-any.whl/pip/locations.py", line 9, in <module>
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.8/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/usr/lib/python3.8/ensurepip/__init__.py", line 263, in _main
    return _bootstrap(
  File "/usr/lib/python3.8/ensurepip/__init__.py", line 181, in _bootstrap
    return _run_pip(args + _PROJECTS, additional_paths)
  File "/usr/lib/python3.8/ensurepip/__init__.py", line 57, in _run_pip
    import pip
  File "<frozen zipimport>", line 259, in load_module
  File "/venv/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 29, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/venv/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 23, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/venv/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/locations.py", line 9, in <module>
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)
```

Launchpad Janitor (janitor) wrote :

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

Changed in python3.8 (Ubuntu):
status: New → Confirmed
blueblob11 (blueblob11) wrote :

This bug affects 20.04 as well:

python3.8 -mvenv .env
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: ['/mnt/d/.env/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers