Skip to content

Python externally-managed-environment

Since Python 3.12 when you try pip3 install [something] you get error externally-managed-environment.

This error occurs when the system package manager is managing Python packages. They decided that pip packages can't be installed system-wide.

You could remove the file with (but it could come back after update):

rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED

You could use flag to force pip package installation:

pip install --break-system-packages your_package

You could use system package manager to install pip package:

apt install python3-your-package

You could use virtual environment:

python3 -m venv my_project_env
source my_project_env/bin/activate
pip install your_package