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.
pre-commit
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.
.pre-commit-config.yaml
- 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.
.github/workflows/ci.yml
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.
Related guides
pre-commit "RuntimeError: ... Cannot install ... environment" in CIFix pre-commit "RuntimeError: Cannot install ... environment" in CI - the framework could not build a hook la…
pre-commit "node/python/ruby/go not found" for a hook language in CIFix pre-commit hook language runtime errors in CI - a hook needs node, python, ruby, or go to build its envir…
pre-commit cannot fetch hook repos (offline / no cache) in CIFix pre-commit network failures cloning hook repos in CI - with no cached PRE_COMMIT_HOME and no network, the…