When I tried to install Pipenv on Python 3.11.2, the install failed with an externally-managed-environment error.
The message means the Python environment is externally managed, so you cannot install packages system-wide with pip. This is not a bug, and it is not the distro being awkward. It comes from PEP 668, and it exists because pip and your system package manager both write to the same directories. When pip overwrote a file that apt or dnf depended on, things broke later, in ways that were nearly impossible to trace back.
The block is triggered by a real marker file, which is worth knowing about because it tells you exactly which interpreter is protected:
ls /usr/lib/python3.11/EXTERNALLY-MANAGED
cat /usr/lib/python3.11/EXTERNALLY-MANAGEDThe contents of that file are what pip prints at you. Distributions use it to point you at their preferred fix.
For a project: a virtual environment
A virtual environment is a private copy of Python's package directory that belongs to your project rather than the OS. Nothing the system depends on lives inside it, so pip is free to write there.
python3 -m venv myenv
source myenv/bin/activateThe environment is now active and pip installs into it rather than system-wide:
pip install pipenvWhen you are done, deactivate it. And if you want it gone entirely, delete the directory, because that is all a venv is:
deactivate
rm -rf myenvFor a command-line tool: pipx
Pipenv is a tool you run, not a library you import, so there is a better fit. pipx creates a dedicated virtual environment for each application and puts the command on your PATH, so you get the tool without managing an environment for it.
sudo apt install pipx
pipx install pipenv
pipx ensurepathThis is the right default for anything you want available system-wide as a command.
The override, and when not to use it
There is a flag that skips the check entirely:
pip install --break-system-packages pipenvThe name is honest about what it does. It is reasonable inside a throwaway container or CI job where the whole filesystem is discarded afterwards. On a machine you actually use, it can break your OS package manager months later, long after you have forgotten you ran it. Reach for the venv or pipx instead.





