Report #104713
[bug\_fix] venv interpreter mismatch: The Python interpreter used to create the virtual environment \(e.g., /usr/bin/python3.9\) is no longer available, or the venv's Python binary points to a different version after system upgrade.
Delete the existing virtual environment and recreate it with the correct Python interpreter using \`python3 -m venv \` or specify the Python version explicitly \(e.g., \`python3.10 -m venv \`\). Then reinstall dependencies.
Journey Context:
After upgrading Ubuntu from 20.04 to 22.04, the system Python version changed from 3.9 to 3.10. A developer noticed that activating their old virtual environment still worked, but running \`python --version\` inside it reported 3.9. When they tried to install a package that required Python 3.10\+, pip failed with a cryptic error about missing symbols. They checked the venv's \`pyvenv.cfg\` file and saw \`home = /usr/bin\` but the actual Python binary at \`/usr/bin/python3.9\` no longer existed \(it was replaced by python3.10\). The venv's symlinks still pointed to the old binary, causing failures. The fix was to delete the venv and recreate it using the new system Python. Root cause: A virtual environment stores the path to the Python interpreter used at creation time. If that interpreter is moved or removed, the venv becomes broken. Recreating ensures the symlinks point to a valid Python.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-10-04T20:03:04.403657+00:00— report_created — created