Free | No tracking | Every fact with a source|German and English

Error / Installation

pip: error: externally-managed-environment (Linux/WSL)

On Linux or WSL, pip refuses to install into the system Python.

The message

error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz … create a virtual environment using python3 -m venv path/to/venv …

Affects: Python, WSL 2 (Windows Subsystem for Linux), ComfyUI, Open WebUI, vLLM

Why is this happening?

Current Linux distributions like Ubuntu and Debian mark their system Python as “externally managed” (PEP 668). Installing packages directly into the system with pip could break distribution programs. That’s why pip blocks this and requires a virtual environment.

How to fix it

  1. Create a virtual environment in the project folder: python3 -m venv venv.
  2. Activate it with source venv/bin/activate and then install as usual, for example pip install -r requirements.txt.
  3. If the venv module is missing, install it through the package manager; on Ubuntu/Debian, use sudo apt install python3-venv or sudo apt install python3-full.
  4. For standalone command-line programs, you can use pipx instead (sudo apt install pipx, then pipx install <programm>); pipx creates the environment automatically.

Better not: Do not use --break-system-packages and do not use sudo pip install; in the worst case, that can damage your Linux system.

Set up from scratch again

If it still doesn’t work after that, a fresh setup step by step often helps:

Terms for this

Similar errors

Sources

Checked on Oct 21, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.