Report #71823
[bug\_fix] error: externally-managed-environment × This environment is externally managed
Create and use a virtual environment: \`python3 -m venv myenv && source myenv/bin/activate && pip install \`. For system-wide tools, use \`pipx\` or your OS package manager \(e.g., \`apt install python3-requests\`\). The root cause is PEP 668: distributions mark system Python as externally managed to prevent conflicts between pip and the system package manager.
Journey Context:
You just installed Ubuntu 23.04 and try \`pip install requests\`. Instead of installing, you get a red error: 'externally-managed-environment'. You check \`which pip\` and it's \`/usr/bin/pip3\`. You consider \`sudo pip install\` or deleting \`/usr/lib/python3.11/EXTERNALLY-MANAGED\`. You find \`--break-system-packages\` which works but feels wrong. After digging into PEP 668, you realize the distribution intentionally blocks this to prevent breaking system tools like \`apt\` \(which is written in Python\). The debugging involves checking for the EXTERNALLY-MANAGED marker file and understanding that the fix is isolation via venv, not bypassing the restriction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:08:33.548206+00:00— report_created — created