pip
pip copied to clipboard
pip refuses to install pipx in my user environment
Description
Pip error messages ask me to use pipx
. However trying to install pipx
makes pip crash and ask me to install pipx
which I'm already trying to do.
The pip application is essentially broken now and cannot be used.
Note that I'm trying to install the packages in my user environment (--user
), but pip talks about "system-wide" installs.
Is these some big-brother "system " taking over my user environment and managing it now? I was under impression that my user environment is my own. I'm not mingling with the system's environment and the system should not mingle in my environment.
I see that this essentially breaks all the python CLI binaries/scripts installation, since they are no longer in PATH. I have definitely installed nox
and other tools on this system, but calling nox
in the command line no longer works.
I have none of these issues when using pip on Windows. Is Linux still supported by pip?
$ pipx nox
Command pipx not found
$ pip3 install pipx --user
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Expected behavior
I expect:
-
pip install pipx --user
to always work -
pip install some-tool --user
to always work - Once I install a tool using
pip install some-tool --user
, I should be able to calltool
from the command-line
pip version
23.3
Python version
3.11
OS
Debian 6.5.13-1
How to Reproduce
pip3 install nox --user && nox
pip3 install pipx --user && pipx
Output
No response
Code of Conduct
- [X] I agree to follow the PSF Code of Conduct.
I'm not mingling with the system's environment and the system should not mingle in my environment.
That's not how Linux (or most platforms) work though.
It's very possible to run a package your system provides and it breaks because it assumes your system Python won't have user overrides, even when running as a non root user. This means that system utilities which do not need to run as root are can be broken.
You have a number of options, including but not limited to:
- Install pipx from your OS distro, or another software package manager, I beleive this is how pipx documents installation instructions
- Use
--break-system-packages
: https://pip.pypa.io/en/stable/cli/pip_install/?highlight=break%20#cmdoption-break-system-packages - Contact your OS distro for support
- Install in a user Python environment not based your OS distro's system Python (not sure how appropriate this is for pipx specifically)