error: externally-managed-environment
Updated
pip's "externally-managed-environment" error means your Python is managed by the OS, Homebrew or uv and refuses system-wide installs. Why, and the right fix.
What you see
python -m pip install requests
error: externally-managed-environment
× This environment is externally managed
╰─> This Python installation is managed by uv and should not be modified.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.What it means
Your Python is marked as externally managed: something other than pip looks after its packages, and pip refuses to install into it outside a virtual environment. The marker is a file called EXTERNALLY-MANAGED in the interpreter's standard library folder. The rule comes from PEP 668.
The point is to stop pip and the system package manager from overwriting each other's files. On Debian or Ubuntu, apt owns the system Python; with Homebrew, brew does. A pip install there can break tools of the operating system that depend on exact versions.
The text inside the box comes from whoever ships your Python, so it differs. The example above ran on uv's managed builds, which ship the marker too; Homebrew and Debian print their own advice in the same frame.
Why it happens
- You are not in a virtual environment. Inside one, the marker does not apply.
- Your Python comes from a package manager that marks it, such as Homebrew, recent Debian and Ubuntu releases, or uv.
- A tutorial told you to run
pip installglobally. Many were written before distributions adopted the marker.
How to fix it
Make a virtual environment for the project and install there. This is what the error is asking for:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install requests
For a command-line tool that you want everywhere, such as black or httpie, install it in its own environment with pipx install black or uv tool install black.
For a library the operating system packages itself, install the system package, for example sudo apt install python3-requests.
--break-system-packages makes pip install anyway. The name is accurate: use it only in a throwaway container, never on a machine you keep.
Example: --user is refused too
python -m pip install --user requests
error: externally-managed-environment
× This environment is externally managed
╰─> This Python installation is managed by uv and should not be modified.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.| Python | Prints |
|---|---|
| 3.12–3.15 | error: externally-managed-environment |
Run on CPython 3.12.15, 3.13.17, 3.14.9 and 3.15.1, on October 25, 2026.
How each Python version words it
| Python | Prints |
|---|---|
| 3.12–3.15 | error: externally-managed-environment |
Run on CPython 3.12.15, 3.13.17, 3.14.9 and 3.15.1, on October 25, 2026.
pip checks for the marker, not Python. Python itself has not changed here; what changed is which builds carry the marker. The runs above used pip 26.2.2, the version each of uv's builds bundles.
Questions
Can I just delete the EXTERNALLY-MANAGED file?
pip will stop refusing, and the next system update may overwrite or remove what you installed, or your install may break a system tool. A virtual environment takes one command and avoids both.
Why does it work inside a virtual environment?
The specification exempts virtual environments: a venv has its own site-packages, so nothing the operating system owns is touched.
Sources
- Externally managed environments, Python Packaging User Guide
- PEP 668: Marking Python base environments as "externally managed", Python Enhancement Proposals
- venv: creation of virtual environments, Python documentation
Read on October 25, 2026.