Closed fizyk closed 4 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-commit
Probably it's somehow related to this new feature: https://github.com/pypa/pip/issues/11924
I got this issue with pre-commit
installed via Homebrew.
Command to apply the fix from @KochankovID:
$(brew --prefix)/opt/pre-commit/libexec/bin/python3 -m pip install virtualenv==v20.24.5
I can not use the virtualenv
version pinning solution because I cannot easily ask other developers on my team to apply it. However, it appears that by manually specifying the matching ; albeit at the cost of revisiting the workaround for every gitlint-core
version does provide a workaround that does not force other developers to run extra commandsgitlint
version update until virtualenv
/pip
is fixed upstream:
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
additional_dependencies: [gitlint-core==v0.9.1]
stages: [commit-msg]
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.
20.24.7 fails as well.
Rather than posting here, please test and add details to https://github.com/pypa/pip/issues/12372 so pip developers prioritize user needs
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.
I doubt you'll have much luck with either. This needs to be fixed in pip
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:
VIRTUALENV_PIP=23.3.2 pre-commit install-hooks
Only necessary until virtualenv either updates the pip package on its schedule or provides 23.3.2+ by default.
My workaround (that actually works this time) was to go to the pre-commit git repo for gitlint on my disk, and download the tags for the repository. This allowed setuptools-scm
to resolve the desired tag locally while building the wheel. This would seem to imply that the logic could be fixed in several places to provide a better experience:
pip
itself, presumably by consulting the upstream repo for tag/commit associationssetuptools-scm
by checking the origin repository for tags that might be missing in the local repogitlint
by providing a fallback version, for this exact scenario where tag is not properly downloaded into the local repoFallback configuration is documented for setuptools-scm in the configuration parameters, and updating it could be rolled into the release tagging process. Or, the fallback could be set to something sane but conservative, like the latest major version.
New virtualenv tag that bumps pip to 24.0 https://github.com/pypa/virtualenv/releases/tag/20.25.1.
@vfazio as in that version of pip fixes this bug?
@sigmavirus24
pip 23.3.2 technically fixed it, but no version of virtualenv was tagged with that version (though it would have slowly picked up the new pip at some point due to it's internal update policy). virtualenv now specifically embeds 24.0, which includes the fix as well.
So I'll close this then. The resolution being either
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:
results of running on a clean pre-commit env (cleared pre-commit cache)