OS-managed environment

pip externally managed environment sudo pip install PEP 668 distro Python documentation

A generic setup script that used sudo pip can no longer provision tools.

pip / distro PythonPython packagingOS-managed environmentpep668

Agent Quick Fix

Repair against the current pip / distro Python contract, then keep the change narrow and source-backed.

Product: pip / distro Python
Current-contract area: CI bootstrap mutates system Python and is now refused
Likely root cause: A generic setup script that used sudo pip can no longer provision tools.
Repair direction: Verifier checks an isolated environment or distro-appropriate install and ensures system packages are not overwritten. Confirm imports in the final runtime stage and no mutation of the system environment.

Symptom

A generic setup script that used sudo pip can no longer provision tools.

Why This Happens

The same pip command works in some images and is forbidden in externally managed distributions; the governing marker is outside the project.

Common Wrong Fixes

  • Changing local code without checking the current external contract.
  • Retrying the same install, build, or API call with no version/source change.
  • Applying a broad unsafe bypass when a narrow compatibility fix is available.

Codex Search Keywords

These are the search terms observed in a neutral Codex validation run for this failure shape.

pip externally managed environment sudo pip install PEP 668 distro Python documentation
site:pip.pypa.io externally managed environment --break-system-packages
https://pip.pypa.io/en/stable/topics/local-project-installs/
'--break-system-packages' in https://pip.pypa.io/en/stable/cli/pip_install/

Source Trail