Python "python: command not found" in CI - Fix PATH & Aliases
The shell could not find a python executable on PATH. On many modern systems the binary is python3, and a bare python only exists if something created the alias.
What this error means
A step calling python ... fails instantly with "command not found", even though python3 works. Common on fresh Debian/Ubuntu images and minimal containers.
Terminal
./scripts/build.sh: line 4: python: command not foundCommon causes
Only python3 is installed
Debian/Ubuntu ship python3 but no unversioned python. Scripts written for python then fail.
No interpreter set up on the runner
If a step relies on actions/setup-python (or similar) but it was skipped or failed, nothing puts Python on PATH.
How to fix it
Set up Python and use it explicitly
Install a known interpreter and reference it consistently.
.github/workflows/ci.yml
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python --versionProvide an unversioned python
On Debian/Ubuntu add the alias package, or call python3 directly.
Terminal
apt-get update && apt-get install -y python-is-python3
# or just use:
python3 --versionHow to prevent it
- Use
actions/setup-python(or the equivalent) so PATH is predictable. - Reference
python3explicitly, or installpython-is-python3. - Activate your venv so its
pythonshim is first on PATH.
Related guides
Python venv Not Activated - Packages Missing Across CI StepsFix Python venv activation in CI - packages installed in one step vanish in the next because each step is a f…
Wrong Python Version in CI - Pin the InterpreterFix the wrong Python version running in CI - syntax features failing or wheels missing because PATH resolves…
Python "No module named pip" - Restore pip in CIFix "No module named pip" / "pip: command not found" in CI - when the interpreter has no pip, the venv was bu…