Skip to content
Latchkey

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 found

Common 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 --version

Provide 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 --version

How to prevent it

  • Use actions/setup-python (or the equivalent) so PATH is predictable.
  • Reference python3 explicitly, or install python-is-python3.
  • Activate your venv so its python shim is first on PATH.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →