Report #17803
[bug\_fix] ModuleNotFoundError: No module named 'pip' inside venv after system Python upgrade
Deactivate the broken virtual environment, delete the \`venv\` directory, and recreate it using the new Python version \(\`python3.9 -m venv venv\` or \`python3 -m venv venv\`\), then reinstall dependencies.
Journey Context:
You run \`apt upgrade\` on your Ubuntu workstation, which upgrades the system Python from 3.8 to 3.9. You navigate to your project, activate your existing virtual environment \(\`source venv/bin/activate\`\), and attempt to run \`pip list\` to check installed packages. You immediately get \`ModuleNotFoundError: No module named 'pip'\`. You check \`which python\` and it points to \`venv/bin/python\`, but inspecting the shebang inside \`venv/bin/pip\` reveals it points to the old Python 3.8 interpreter path \(\`/usr/bin/python3.8\`\), which no longer exists after the upgrade. Examining \`venv/pyvenv.cfg\`, you see \`version = 3.8\` and \`home = /usr/bin\` pointing to the old base interpreter. You realize that virtual environments embed absolute paths to the base Python interpreter and are not portable across Python minor versions; the upgrade broke the symlinks and shebangs. You deactivate, remove the \`venv\` directory entirely, recreate it with \`python3.9 -m venv venv\` \(which now uses the new Python\), activate it, and reinstall dependencies, restoring \`pip\` functionality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:23:35.105001+00:00— report_created — created