Misleading error creating python virtual environment, says need to install python3.11-venv

Bug #2065422 reported by thewade

This bug report will be marked for expiration in 57 days if no further activity occurs. (find out why)

8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3-defaults (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

On Ubuntu 24.04 when I try to create a virtual environment I get this error:

$ python3 -m venv pyenv
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 install python3.11-venv

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

I am running the python3 version included with the distro

$ python3 --version
Python 3.12.3

The error suggests I install python3.11-venv however that package does not exist in 24.04 and what I need to install is python3-venv instead.

Tags: noble
thewade (wade-penner)
description: updated
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for taking your time to report this issue and help making Ubuntu better.

I was unable to reproduce this issue. I get the same message, but the suggestion is `apt install python3.12-venv`. That's more expected, since as you mentioned Python 3.11 was removed before release of 24.04 (https://launchpad.net/ubuntu/+source/python3.11/+publishinghistory)

The python3 binary is a symlink to the actual python version handled by python3-defaults, so I've taken the liberty of moving this bug report there. It would be interesting to see which package version you are running. My system lists
$ dpkg -S `command -v python3`
python3-minimal: /usr/bin/python3
$ apt policy python3-minimal
python3-minimal:
  Installed: 3.12.3-0ubuntu1
  Candidate: 3.12.3-0ubuntu1
  Version table:
 *** 3.12.3-0ubuntu1 500
        500 http://no.archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status

And or run `apport-collect 2065422` which will add additional debug information to the bug report. I'm curious whether this is a fresh install or upgrade from an older Ubuntu release.

affects: python3.11 (Ubuntu) → python3-defaults (Ubuntu)
Changed in python3-defaults (Ubuntu):
status: New → Incomplete
tags: added: nobl
tags: added: noble
removed: nobl
Revision history for this message
thewade (wade-penner) wrote (last edit ):

It was an upgrade from 20.04.

$ dpkg -S `command -v python3`
python3-minimal: /usr/bin/python3

$ apt policy python3-minimal
python3-minimal:
  Installed: 3.12.3-0ubuntu1
  Candidate: 3.12.3-0ubuntu1
  Version table:
 *** 3.12.3-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status

I just tried the same from a clean install and I did not see the issue.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Hm... might be due to it being an upgrade with some packages or config lingering. That explains why I didn't see it because I tested on a clean install as well. Could you please check
$ ls -la `command -v python3`
lrwxrwxrwx 1 root root 10 Apr 12 15:29 /usr/bin/python3 -> python3.12

whether it is pointing to python3.11 somehow?

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.