# error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

- **ID:** `python/pip-externally-managed-environment`
- **Domain:** python
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

PEP 668 marker file (EXTERNALLY-MANAGED) exists in the system Python's stdlib, telling pip not to modify the OS-managed interpreter.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (98% success)
   ```
   python3 -m venv .venv
source .venv/bin/activate
python -m pip install requests
   ```
2. **** (92% success)
   ```
   sudo apt install python3-requests
# or for CLI apps
pipx install ruff
   ```

## Dead Ends

- **** — --user still writes into the externally-managed interpreter's user site-packages and is blocked. (90% fail)
- **** — Running as root does not bypass the PEP 668 marker and can corrupt OS packages. (95% fail)
