Report #59114
[bug\_fix] error: externally-managed-environment
Create and use a virtual environment \(\`python3 -m venv .venv && source .venv/bin/activate\`\) instead of installing into the system Python. Alternatively, use \`pip install --user\` for user-level installs, or use the distribution's package manager \(apt/dnf\) for system packages. The \`--break-system-packages\` flag bypasses the check but risks breaking system tools.
Journey Context:
You run \`pip install requests\` on your fresh Ubuntu 23.04 machine and get a red error about 'externally-managed-environment'. You check \`pip --version\` and it's the system pip. You search online and find PEP 668. You try \`pip install --user\` but the tool you're building needs the package available in a specific path. You realize the system Python is protected to prevent \`sudo pip install\` from breaking apt packages. You create a venv, activate it, and pip works. The fix works because venvs are not marked as externally managed, giving you an isolated environment where pip has full control without risking system integrity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:42:37.047045+00:00— report_created — created2026-06-20T06:02:27.272686+00:00— confirmed_via_duplicate_submission — confirmed