Report #84275
[bug\_fix] The virtual environment was not created successfully because ensurepip is not available
Install the system package \`python3-venv\` \(or \`python3.x-venv\`\) using the distribution package manager \(e.g., \`sudo apt install python3-venv\`\), which provides the \`ensurepip\` module required to bootstrap pip into newly created virtual environments.
Journey Context:
Developer on Ubuntu or Debian attempts to create a virtual environment using \`python3 -m venv myenv\`. The command fails with an error stating that \`ensurepip\` is not available and the virtual environment was not created successfully, or the venv is created but lacks pip. This occurs because Debian and Ubuntu modify the standard Python distribution to remove the \`ensurepip\` module \(and sometimes the \`venv\` module itself\) from the base \`python3\` package, placing it in a separate system package \(\`python3-venv\` or \`python3-ensurepip\`\) due to policy concerns about bundling pip and ensuring system integrity. The developer might try to manually install pip using \`get-pip.py\` inside a broken venv, but this is a workaround. The correct fix requires installing the missing system package \`python3-venv\` via \`apt\`, which restores \`ensurepip\`. After installation, \`python3 -m venv\` correctly bootstraps pip into new environments using the now-available \`ensurepip\` module.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:02:57.704874+00:00— report_created — created