Python "No module named pip" - Restore pip in CI
The interpreter you are calling has no pip available. Either pip was never installed for this Python, a venv was created without it, or PATH is resolving the wrong interpreter.
What this error means
Running pip reports "command not found", or python -m pip reports "No module named pip". The interpreter itself works; it just has no pip module installed.
/usr/bin/python3: No module named pip
# or
pip: command not foundCommon causes
Minimal Python without pip
Some base images ship the interpreter but not pip to keep the image small. python3 runs, but the pip module is absent.
venv created with --without-pip
A virtual environment built with --without-pip (or on a system where ensurepip is disabled) has no pip inside it.
How to fix it
Bootstrap pip with ensurepip
ensurepip ships with CPython and reinstalls pip into the current interpreter.
python3 -m ensurepip --upgrade
python3 -m pip --versionInstall the distro pip package
On Debian/Ubuntu where ensurepip is stripped, install pip via apt.
apt-get update && apt-get install -y python3-pipAlways call pip via the interpreter
- Use
python -m pip ...so pip matches the active interpreter, not whateverpipis first on PATH. - Confirm with
python -m pip --versionwhich Python and which pip you are using.
How to prevent it
- Use a base image that includes pip, or run
ensurepipearly in the job. - Create venvs without
--without-pip. - Invoke pip as
python -m pipconsistently in CI.