nox "Python interpreter X not found" in CI
nox tried to create a virtualenv for a session pinned to a specific Python (@nox.session(python="3.11")), but no interpreter with that version is on PATH, so the session cannot run.
What this error means
nox fails or marks the session failed with "Python interpreter 3.11 not found" because the runner only has a different version installed.
python
nox > Python interpreter 3.11 not found.
nox > Run nox using a Python interpreter that has 3.11, or set --no-error-on-missing-interpreters
nox > Session tests-3.11 failed.Common causes
The session Python is not installed
A session pinned to a version needs that interpreter on PATH; the runner provisioned a different one.
A multi-version session list with one interpreter present
Parametrized sessions across several Pythons require all of them installed; only one was set up.
How to fix it
Install each Python the sessions request
- Enumerate the versions named in your
nox.session(python=...)decorators. - Provision them all with setup-python.
- Re-run nox.
.github/workflows/ci.yml
- uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12Run one session per matrix job
Select a single session matching the matrix Python so only one interpreter is needed per job.
.github/workflows/ci.yml
nox --session "tests-${{ matrix.python-version }}"How to prevent it
- Provision every interpreter your nox sessions request.
- Or shard one session per CI matrix entry.
- Keep session Python pins aligned with the provisioned versions.
Related guides
tox "py3X: InterpreterNotFound" in CIFix tox "py3X: InterpreterNotFound" in CI - tox cannot find a Python interpreter for an environment because t…
nox session failed in CIFix a failing nox session in CI - nox reports a session failed because a command inside it exited non-zero or…
pyenv "version not installed" on the runner in CIFix pyenv "version `X' is not installed" in CI - the .python-version pins an interpreter pyenv has not built…