Report #74188
[bug\_fix] error: externally-managed-environment × This environment is externally managed
Create and activate a virtual environment instead of installing globally: \`python3 -m venv .venv && source .venv/bin/activate && pip install \`. Alternatively, use \`pipx\` for applications or \`pip install --user\` if the distribution allows it, though \`--break-system-packages\` is discouraged as it can break OS components.
Journey Context:
A developer on Ubuntu 24.04 opens a terminal and runs \`pip install requests\`, a command that worked for years. Instead of success, they hit the 'externally-managed-environment' error. They try \`sudo pip install\`, receiving the same error. Confused, they search the web and discover PEP 668, learning that modern Linux distributions now mark their system Python as externally managed to prevent conflicts with apt packages. They try the \`--break-system-packages\` flag suggested online, which works but triggers warnings about OS stability. Digging deeper, they realize the correct pattern is to always use a venv for project work. They run \`python3 -m venv .venv\`, activate it, and pip works as expected, isolating their dependencies from the system Python.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:07:33.441013+00:00— report_created — created