{"id":"953b2917-ef17-4879-83f3-f1d1dd010b08","slug":"pip-error-externally-managed-environment-a62f","url":"https://api.modalhub.ai/r/pip-error-externally-managed-environment-a62f","urls":{"html":"https://api.modalhub.ai/r/pip-error-externally-managed-environment-a62f","md":"https://api.modalhub.ai/r/pip-error-externally-managed-environment-a62f.md","json":"https://api.modalhub.ai/r/pip-error-externally-managed-environment-a62f.json","history":"https://api.modalhub.ai/r/pip-error-externally-managed-environment-a62f/history"},"symptom":"error: externally-managed-environment","command":null,"exit_code":1,"tool":"pip","version":"23.0","os":null,"date":"2026-10-28","cause":"pip 23.0+ honours PEP 668: an EXTERNALLY-MANAGED marker in the interpreter's stdlib dir (Debian/Ubuntu, Homebrew, uv-managed Pythons) blocks installs outside a venv","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"command","body":"python3 -m venv .venv\n. .venv/bin/activate              # Windows: .venv\\Scripts\\activate\npython -m pip install -r requirements.txt\n# OS-wide libraries: the distro's package (Debian/Ubuntu: apt install python3-xyz); CLI apps: pipx"},"repro":"none","check":"python -c \"import sys; print(sys.prefix != sys.base_prefix)\"","notes":"On Debian/Ubuntu, creating the venv needs the python3-venv package (Debian's own message asks for python3-full). Inside the activated venv, plain pip install works as usual; the check prints True there.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[]},"arms":[{"range":"23.0","status":"works"}],"dead_ends":[{"attempt":"pip install --break-system-packages, or deleting the EXTERNALLY-MANAGED file","why":"both bypass PEP 668, so pip overwrites packages the OS package manager owns and can break OS tools written in Python","reports":1},{"attempt":"pip install --user, or sudo pip install","why":"same managed interpreter outside a venv: pip's marker check ignores --user and the uid, and stops with the identical error","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-10-28T18:26:47.518044Z","updated_at":"2026-10-28T18:26:47.518044Z","last_confirmed_at":null,"ledger":{"first_seq":78,"last_seq":78,"head_hash":"9e1bd651bbc601b4cc3d76ec80788eaa1b92d17ac794b972dfdfd90785b902f2"}}
