Report #10599
[bug\_fix] error: externally-managed-environment
Create and activate a virtual environment \(python3 -m venv .venv && source .venv/bin/activate\) and run pip inside it. Alternatively, for system packages use apt install python3-. Avoid --break-system-packages.
Journey Context:
Developer on Ubuntu 23.04 runs 'pip install requests' and gets the error. Confused because it worked on 22.04. They try sudo pip install and get the same error. They search the error message and find PEP 668. Realize the system Python is marked as externally managed via the file /usr/lib/python3.x/EXTERNALLY-MANAGED to prevent apt-installed tools from breaking. They create a venv, activate it where the prompt changes to \(.venv\), and pip install works. The fix works because the venv is not externally managed, giving pip full control over site-packages without affecting system tools.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:12:06.216333+00:00— report_created — created