Debian Bookworm PEP 668: All pip packages need to be installed into a virtualenv
Debian Bookworm:
apt-listchanges: News
python-pip (23.0+dfsg-1) unstable; urgency=medium
This version of pip introduces PEP 668 support. Debian's python3.11 interpreter will soon (>= 3.11.1-3) declare the installation to be EXTERNALLY-MANAGED, instructing pip to disallow package installation outside virtualenvs.
See: https://peps.python.org/pep-0668/
Practically, this means that you can't use pip to install packages outside a virtualenv, on a Debian system, any more.
See /usr/share/doc/python3.11/README.venv for more details. If that isn't available yet, check: https://salsa.debian.org/cpython-team/python3/-/blob/master/debian/README.venv
-- Stefano Rivera stefanor@debian.org Wed, 01 Feb 2023 19:14:08 -0400
And from the README.venv
:
Python applications
If you need to install a Python application (or version) that isn't packaged in
Debian, we recommend that you install it with pipx (in the "pipx" Debian package). pipx will create an isolated environment to install the application and its dependencies in, separate from all other applications and system Python modules.
Python library modules
If you need to install a Python library module (or version) that isn't packaged in Debian, we recommend installing it into a virtualenv, where possible. You can create virtualenvs with the venv Python stdlib module (in the "python3-venv" Debian package) or the virtualenv Python 3rd-party tool (in the "virtualenv" Debian package).
Both of these will create an isolated environment, with a copy of pip in it.
After activating the environment, you can install python applications and library modules into the virtual environment.
If needed, the isolated environment can also have access to system Python modules, with the "--system-site-packages" flag.
There is a community.general.pipx module and a community.general.pipx_info module.