gitlint: installing hook on pre-commit fails with newest virtualenv (>20.24.5) present
virtualenv 20.24.6 updates embed setuptools from 6.2.0 to 6.2.2 and pip to 23.3.1
pip 23.3 includes some changes to dependency resolution, so that’s what might cause the issue.
Pre-commit config:
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
- id: gitlint-ci
stages:
- manual
args: [--commits, origin/master..HEAD]
results of running on a clean pre-commit env (cleared pre-commit cache)
❯ pre-commit run --hook-stage manual gitlint-ci ─╯
[INFO] Installing environment for https://github.com/jorisroovers/gitlint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('[HOME]/.cache/pre-commit/repos8g02w1x/py_env-python3.10/bin/python', '-mpip', 'install', '.', './gitlint-core[trusted-deps]')
return code: 1
stdout:
Processing /home/fizyk/.cache/pre-commit/repos8g02w1x
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Processing ./gitlint-core
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
INFO: pip is looking at multiple versions of gitlint to determine which version is compatible with other requirements. This could take a while.
stderr:
ERROR: Could not find a version that satisfies the requirement gitlint-core==0.1.dev1+gacc9d9d (from gitlint) (from versions: 0.17.0, 0.18.0, 0.19.0.dev73, 0.19.0.dev75, 0.19.0.dev76, 0.19.0.dev77, 0.19.0.dev78, 0.19.0.dev79, 0.19.0.dev80, 0.19.0.dev81, 0.19.0.dev82, 0.19.0rc1, 0.19.0rc2.dev1, 0.19.0rc2, 0.19.0rc3.dev1, 0.19.0, 0.19.1.dev1, 0.19.1.dev2, 0.19.1, 0.19.2.dev1, 0.19.2.dev2, 0.19.2.dev3, 0.19.2.dev4, 0.19.2.dev5, 0.20.0.dev2, 0.20.0.dev3, 0.20.0.dev6, 0.20.0.dev7, 0.20.0.dev8, 0.20.0.dev9, 0.20.0.dev10, 0.20.0.dev11, 0.20.0.dev12, 0.20.0.dev13, 0.20.0.dev14, 0.20.0.dev15, 0.20.0.dev16, 0.20.0.dev17, 0.20.0.dev18, 0.20.0.dev19, 0.20.0.dev20, 0.20.0.dev21, 0.20.0.dev22, 0.20.0.dev23, 0.20.0.dev24, 0.20.0.dev25, 0.20.0.dev27, 0.20.0.dev29, 0.20.0.dev30, 0.20.0.dev31, 0.20.0.dev32, 0.20.0.dev33, 0.20.0.dev34, 0.20.0.dev35, 0.20.0.dev36, 0.20.0.dev37, 0.20.0.dev38, 0.20.0.dev39, 0.20.0.dev40, 0.20.0.dev41, 0.20.0.dev42, 0.20.0.dev43, 0.20.0.dev44, 0.20.0.dev45, 0.20.0.dev48)
ERROR: No matching distribution found for gitlint-core==0.1.dev1+gacc9d9d
Check the log at [HOME]/.cache/pre-commit/pre-commit.log
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 31
- Comments: 15
Commits related to this issue
- chore: fix pre-commit hooks Includes a fix for jorisroovers/gitlint#535. — committed to Problemas-de-Particao-de-Strings/MCSP-Algorithms by TiagodePAlves 7 months ago
- build(pre-commit): add commit-msg to default_install_hook_types Note: we do not upgrade gitlint to 0.19.x because of https://github.com/jorisroovers/gitlint/issues/535 — committed to tueda/donuts by tueda 6 months ago
- Run gitlint with tox Verification of git message is failing because of a pip installation issue: https://github.com/jorisroovers/gitlint/issues/535 https://github.com/pypa/pip/issues/12372 The issue... — committed to opendaylight/integration-test by sangwookha-vz 6 months ago
It looks like there is a problem with new pip version. The obvious fix is:
pip install virtualenv==v20.24.5
before running pre-commitProbably it’s somehow related to this new feature: https://github.com/pypa/pip/issues/11924
I mentioned it in https://github.com/pypa/pip/issues/12372#issuecomment-1857964529, but it should be possible to workaround this issue by telling virtualenv the version of pip to use when seeding the venvs:
Only necessary until virtualenv either updates the pip package on its schedule or provides 23.3.2+ by default.
20.24.7 fails as well.
I doubt you’ll have much luck with either. This needs to be fixed in pip
So I’ll close this then. The resolution being either
For reference: https://github.com/pypa/pip/commit/69b58102f522f0e10d2b3bd31e7b9ee074abd16d
Should we ask pre-commit to pin virtualenv to <=20.24.5 until virtualenv includes a new version of pip without the regression? Or ask pypa to revert the pip change in virtualenv.
Upon further testing, my solution seems to cause a version conflict when actually running the hook install. Embarrassingly I was fooled by running
pre-commit run --all-files
which did not invoke this check.I got this issue with
pre-commit
installed via Homebrew.Command to apply the fix from @KochankovID: