Since the update to Debian bookworm pip stopped working!
With bookworm Debian started to follow PEP 668 and mark their Python installation as externally managed. This makes pip
refuse to install packages so as to not damage this isntallation. This is not a danger for us, since users cannot write to system directories anyway, but this is leads to pip refusing to install to the home directory via python -m pip install --user
.
We recommend to use virtual environments to resolve this issue, i.e. for each for your Python projects
python -m venv myenv
source myenv/bin/activate
python -m pip install pkg1 pkg2 ...
or use tools such as uv, pdm or poetry in alternative to pip. To install these and other tools, that should stand on their own and that you just want to use, we recommend pipx
, which is installed by default on all Linux machines starting with bookworm.
For those that don't want to use virtual environments there is the pip option --break-system-packages
, which you can also add to your pip config at ~/.config/pip/pip.conf
:
[global]
break-system-packages = true
There is no danger in doing this, since the system Python installation cannot be changed on our systems, but we want to highlight that the upstream Python project recommends the usage of virtual environments.
Keywords
- bookworm
- Debian
- pep668
- pip
- python