Skip to content
Latchkey

default_language_version: Pin the Interpreter

default_language_version sets the interpreter version pre-commit uses when it builds each language environment.

Hook environments are built with a specific interpreter. Pinning it makes local and CI runs identical and avoids "executable not found" when a runner lacks the default.

What it does

default_language_version is a top-level map from language to version, e.g. python: python3.11. pre-commit uses that interpreter to create the virtualenv or environment for hooks of that language. A per-hook language_version overrides it.

Common usage

.pre-commit-config.yaml
default_language_version:
  python: python3.11
  node: 20.11.1
repos:
  - repo: https://github.com/psf/black
    rev: 24.4.2
    hooks:
      - id: black
        language_version: python3.12   # override for one hook

Keys

KeyWhat it does
default_language_versionTop-level map of language to interpreter version
python: python3.11Interpreter pre-commit invokes for python hooks
node: <version>Node version for node-language hooks
language_versionPer-hook override of the version
defaultSpecial value meaning "use the system default"

In CI

Make sure the pinned interpreter actually exists on the runner, or install it first. The default_language_version must name an executable on PATH (python3.11), not a bare version number for python. Pinning it keeps CI deterministic across runner image upgrades.

Common errors in CI

"[ERROR] Executable python3.11 not found" means the pinned interpreter is absent from the runner; install it (e.g. via setup-python) or change the pin. "[ERROR] ... is not a valid python version" appears when the value is malformed. For node, a missing version makes pre-commit download one, which can fail behind a proxy.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →