pre-commit additional_dependencies not found in CI
additional_dependencies tells pre-commit to install extra packages into a hook environment (plugins, typing stubs). If one of those packages cannot be resolved or installed, the environment build fails and the hook never runs.
What this error means
The run fails while installing the hook environment with a resolution or download error for a package named in additional_dependencies.
An unexpected error has occurred: CalledProcessError:
command: install flake8-typo==9.9.9
return code: 1
ERROR: No matching distribution found for flake8-typo==9.9.9Common causes
A pinned plugin version does not exist
An additional_dependencies entry pins a version that was never published, so the env install fails.
The plugin is private or offline
The package lives on a private index the hook environment cannot reach, so pip cannot install it.
How to fix it
Pin a published plugin version
- Read the failing install command in the pre-commit log.
- Correct the version to one the index publishes.
- Re-run so the environment builds.
- repo: https://github.com/pycqa/flake8
rev: 7.1.0
hooks:
- id: flake8
additional_dependencies: ['flake8-bugbear==24.4.26']Make private plugins reachable
Expose the private index credentials to the environment so the plugin installs.
env:
PIP_EXTRA_INDEX_URL: https://__token__:${{ secrets.PYPI_TOKEN }}@pypi.internal.example.com/simpleHow to prevent it
- Pin
additional_dependenciesto versions you have verified exist. - Cache PRE_COMMIT_HOME so a good env is not rebuilt every run.
- Provide index credentials for private plugins in CI.