error: externally-managed-environment

  • Raspberry Pi
  • Linux

You may see

error: externally-managed-environment

Why it happens

  • Raspberry Pi OS stops pip from changing the system's Python.

How to fix it

  1. Make one: python3 -m venv --system-site-packages ~/pi-env.
  2. Switch it on: source ~/pi-env/bin/activate.
  3. Run pip install again.

It worked if: The prompt starts with (pi-env) and pip succeeds.

From the official documentation. From our Pi lesson and the Raspberry Pi documentation. Sources: Raspberry Pi documentation.

Didn't help? Search another error or ask us.