Older pip rejects the --break-system-packages flag
Fix it fast
Most common cause, 1 of 2The script targets new distributions but runs on an older system Python
On those hosts the flag can simply go.
# works with pip 22 and pip 26 alike
PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip install requests
# Dockerfile form
ENV PIP_BREAK_SYSTEM_PACKAGES=1
RUN python3 -m pip install -r requirements.txtShort answer
pip prints no such option: --break-system-packages when it is older than 23.0.1, the release that added the flag, for example the pip 22.0.2 that Ubuntu 22.04 installs from apt. Such pip never reads the EXTERNALLY-MANAGED marker, so the flag is not needed there. Drop it, or set PIP_BREAK_SYSTEM_PACKAGES=1, which older pip silently ignores.
Which cause do you have?
Ask the same interpreter your script uses for its pip version and location. Below 23.0.1 the flag does not exist; the path shows whether that pip belongs to the system Python (cause 1) or to a virtual environment (cause 2).
python3 -m pip --versionThen find the line you see in this list and open its fix:
- 1The script targets new distributions but runs on an older system Python
pip reports 22.x or older from a system path such as /usr/lib/python3/dist-packages, as on Ubuntu 22.04 or images built on it - 2The command runs inside a virtual environment that has an old pip
The pip path printed by the first step sits inside a venv or virtualenv folder, and its version is below 23.0.1
What does the error look like?
no such option: --break-system-packagespip install [options] <requirement specifier> [package-index-options] ...
Cause 1 of 2
The script targets new distributions but runs on an older system Python
You seepip reports 22.x or older from a system path such as /usr/lib/python3/dist-packages, as on Ubuntu 22.04 or images built on it
Check
no such option: --break-system-packages from a system pip means that pip predates the option. pip 23.0 began honouring the EXTERNALLY-MANAGED file and 23.0.1 added the override, so an older pip never blocks installs and has nothing to override. Ubuntu 22.04 ships python3-pip 22.0.2.
python3 -m pip install --help | grep -c -- --break-system-packagesFix
On those hosts the flag can simply go. When one script or Dockerfile must serve old and new releases, move the setting into the environment: pip skips configuration values it has no option for, so older versions ignore it while 23.0.1 and later apply it.
# works with pip 22 and pip 26 alike
PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip install requests
# Dockerfile form
ENV PIP_BREAK_SYSTEM_PACKAGES=1
RUN python3 -m pip install -r requirements.txtVerify
The install finishes on the old host, and on Ubuntu 24.04 it no longer stops with externally-managed-environment.
python3 -m pip show requests | grep VersionConfirmed by pip.pypa.io
Cause 2 of 2
The command runs inside a virtual environment that has an old pip
You seeThe pip path printed by the first step sits inside a venv or virtualenv folder, and its version is below 23.0.1
Check
PEP 668 says packages inside a virtual environment belong to that environment, and installers only apply the marker outside one. Passing the override in a venv therefore does nothing useful, and an older seeded pip refuses the unknown word.
python -c "import sys; print(sys.prefix != sys.base_prefix)"Fix
Remove the flag from commands that run in the venv. If shared tooling must keep it, upgrade the venv's own pip first so the option is recognised.
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -r requirements.txtVerify
The venv's pip reports 23.0.1 or newer, or the command succeeds once the flag is gone.
.venv/bin/python -m pip --versionConfirmed by peps.python.org
How do I stop it coming back?
- Prefer PIP_BREAK_SYSTEM_PACKAGES in CI images over the command-line flag, because unknown environment settings do not break older pip.
- Upgrade pip as the first step after creating any virtual environment, before installs that pass newer options.
- Test install scripts on the oldest distribution release you still support, not only on the newest.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.