Report #70197
[bug\_fix] pip install fails with \`error: externally-managed-environment\` on Debian/Ubuntu system Python
Do not install into the system interpreter. Create a virtual environment with \`python3 -m venv .venv\`, activate it, and run \`pip install\` inside it. Use \`apt\` only for packages provided by the distribution.
Journey Context:
On Ubuntu 24.04 you run \`sudo pip install requests\` and get \`error: externally-managed-environment: This environment is externally managed\`. You try \`--break-system-packages\` and the package installs, but later \`apt\` warns that unmanaged Python files may break the system. The rabbit hole: the distribution placed an \`EXTERNALLY-MANAGED\` marker file in \`/usr/lib/python3.x/\`, signaling that system \`site-packages\` are owned by the distro. The fix works because a venv creates a separate \`site-packages\` directory that is not externally managed, giving pip full control without risking files the system package manager owns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:24:12.556257+00:00— report_created — created