Report #50757
[bug\_fix] error: externally-managed-environment when running pip install globally
Create and activate a virtual environment \(\`python3 -m venv .venv && source .venv/bin/activate\`\) then pip install inside it. Do not use \`--break-system-packages\`. Root cause: Modern Linux distros \(PEP 668\) mark system Python as externally managed to prevent \`sudo pip\` from breaking system packages like apt.
Journey Context:
Developer on Ubuntu 24.04 opens terminal, clones a repo, and tries \`pip install requests\`. Immediately hits a red error: "externally-managed-environment". Tries \`sudo pip install\`, same error. Googles the error code, lands on PEP 668. Realizes that \`apt install python3-requests\` would work but is outdated. Creates \`.venv\`, activates it, and installs successfully. Learns never to pip install globally on modern systems again.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:40:45.024375+00:00— report_created — created