pip-tools: pip-compile fails with pip==22.0
I upgraded Pip to latest version 22.0 today and pip-tools stopped working.
When I run pip-compile to upgrade my requirements, I now get the following stack trace:
$ pip-compile -U requirements/requirements.in
Traceback (most recent call last):
File "/Users/jordan/.virtualenvs/my-project/bin/pip-compile", line 8, in <module>
sys.exit(cli())
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/piptools/scripts/compile.py", line 342, in cli
repository = PyPIRepository(pip_args, cache_dir=cache_dir)
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 106, in __init__
self._setup_logging()
File "/Users/jordan/.virtualenvs/my-project/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 455, in _setup_logging
assert isinstance(handler, logging.StreamHandler)
AssertionError
As soon as I downgrade pip to v. 21.3.1 for example, the above command succeeds as expected.
Environment Versions
- OS Type: MacOS
- Python version: 3.7.10
- pip version: 22.0
- pip-tools version: 6.4.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 101
- Comments: 22 (6 by maintainers)
Commits related to this issue
- fix: Add `mls` library from GitHub (#8) * Add mls library from GitHub to allow for helper utilities like locate_data - Use hashable URL for piptools to generate hashes (of the form https://... — committed to illinois-mla/phys-398-mla-image by matthewfeickert 2 years ago
- Fixes #1558 — committed to joshringer/pip-tools by joshringer 2 years ago
- Tech: pip-compile est cassé avec pip 22 https://github.com/jazzband/pip-tools/issues/1558 — committed to Delegation-numerique-en-sante/mesconseilscovid by ronnix 2 years ago
- Tech: pip-compile est cassé avec pip 22 https://github.com/jazzband/pip-tools/issues/1558 — committed to Delegation-numerique-en-sante/mesconseilscovid by ronnix 2 years ago
- Block pip 22 pip-tools is incompatible with pip>=22 for now. It is triggering an error on install. See issue https://github.com/jazzband/pip-tools/issues/1558 — committed to Kozea/gibolt by gentooboontoo 2 years ago
- ci: add workaround for problem with pip-tools >= v22 See https://github.com/jazzband/pip-tools/issues/1558 — committed to grouprise/grouprise by sumpfralle 2 years ago
- Work around pip-tools conflict with pip 22 Restrict pip to <22 for now until https://github.com/jazzband/pip-tools/issues/1558 is fixed. — committed to lsst-sqre/gafaelfawr by rra 2 years ago
- fix!: perform pip-downgrade before the pip-compile pip-downgrade should be removed after `pip-tools` team's solution regarding pip log bug be merged and released Related to: https://github.com/jazz... — committed to devmessias/mlops_project by devmessias 2 years ago
- fix(Makefile): install pip<22 to prevent pip-tools bug https://github.com/jazzband/pip-tools/issues/1558 — committed to m0wer/cookiecutter-python-project by m0wer 2 years ago
- Update Dockerfile Fix issue related to https://github.com/jazzband/pip-tools/issues/1558 — committed to theahura/pip-compile-diff-action by theahura 2 years ago
- Temp pip version downgrade in git workflow Pip-tools has issue on pip version >=22.0 https://github.com/jazzband/pip-tools/issues/1558 — committed to Bogdan-Shevchenko-DS/backend-skeleton by Bogdan-Shevchenko-DS 2 years ago
- Update pypi.py Re-inserted handler assertions; included RichPipStreamHandler from pip internal logging module. Fix idea taken from: https://github.com/jazzband/pip-tools/issues/1558#issuecomment... — committed to fsecada01/pip-tools by fsecada01 2 years ago
- Added -allow-unsafe flag to pip_compile in pip_tools.py (#58) * Added -allow-unsafe flag to pip_compile in pip_tools.py Without flag command "fab pip.sync" falling with error "setuptools" version... — committed to django-stars/backend-skeleton by Bogdan-Shevchenko-DS 2 years ago
- chore: bump pip-tools to 6.5.0 to resolve pip bug make upgrade failed because of https://github.com/jazzband/pip-tools/issues/1558 — committed to openedx/edx-ora2 by jansenk 2 years ago
- requirements: Upgrade some libs Upgrade some for security Upgrade pip-tools as older version doesn't work with newest pip https://github.com/jazzband/pip-tools/issues/1558 importlib_metadata is onl... — committed to openownership/data-standard by odscjames 2 years ago
- requirements: Upgrade some libs Upgrade some for security Upgrade pip-tools as older version doesn't work with newest pip https://github.com/jazzband/pip-tools/issues/1558 importlib_metadata is onl... — committed to openownership/data-standard by odscjames 2 years ago
- requirements: Upgrade some libs Upgrade some for security Upgrade pip-tools as older version doesn't work with newest pip https://github.com/jazzband/pip-tools/issues/1558 This version reorders some... — committed to openownership/data-standard by odscjames 2 years ago
- deps: update especially Pillow and pip-tools 1. Pillow: for CVE-2022{22817,24303} 2. pip-tools: for jazzband/pip-tools#1558 — committed to freedomofpress/securedrop-client by cfm 2 years ago
- deps: update especially Pillow and pip-tools 1. Pillow: for CVE-2022-{22817,24303} 2. pip-tools: for jazzband/pip-tools#1558 — committed to freedomofpress/securedrop-client by cfm 2 years ago
- chore: Upgrade python requirements. We got in a situation where the newest version of pip breaks the pinned version of pip-tools from running correctly. https://github.com/jazzband/pip-tools/issues/... — committed to openedx-unsupported/edx-developer-docs by feanil 2 years ago
this is a big bug 🤯
Just to add my 2 cents, I wish
pipwould add acompileandsyncflag to effectively integratepip-tools’s functionality into standardpip. Then issues like this one here won’t arise in stablepipreleases and we would have good dependency management out of the box. Probably not going to happen, but one can dream 😃Nope. The fundamental problem here is that pip does not provide any public API – see https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program.
pip-toolsis one of the few projects in the wild that still uses pip’s internal code as if it’s an API and this sort of breakage is exactly what the risk of that usage pattern is.In fact, Jazzband has more “human resources” than the PyPA does. I’m a member of both, and I can tell you that there’s like… ~100x more people in the Jazzband org. 😃
It effectively comes down to
pip-toolsmaintainers having enough resources and time to actually work on keeping up with pip’s changes. This comes down to someone actually doing things – and, well, evidently, no one has had the time/energy to do that.I’ll note that this project is a part of Jazzband – realistically, basically anyone who is reading this comment can pick up the responsibility to do the work necessary to bring this project up to date. From https://jazzband.co/: “We are all part of this”.
You can also contribute to the whole Jazzband org with $$$ as well, which I’ll encourage you to do if you’re deriving monetary value from this project – like if you’re running a commercial operation that uses thi tool.
This repo does have a daily cron to test against pip
main, which is really good.https://github.com/jazzband/pip-tools/actions/workflows/cron.yml
However, the Python 3.6 job started failing three months ago when pip dropped support for 3.6:
Which masked all the jobs started failing two months ago due to other internal pip changes:
https://github.com/jazzband/pip-tools/runs/4195776918?check_suite_focus=true
https://github.com/jazzband/pip-tools/runs/4419708428?check_suite_focus=true
I’m not sure whether a change in organisation would necessarily help, the pip team will continue to change their private internal functions as they need to (and there will be more changes to use Rich more for better output).
Wherever it lives, I’d suggest a closer eye is paid to the integration of pip with pip-tools, especially in the lead up to pip’s quarterly releases. (And look out for the pip release issues for planned release dates e.g. https://github.com/pypa/pip/issues/10726.)
pip is not doing SemVer;
<23would pin updates to 2022. The only way to prevent this happening again is #1560 & diligently keeping the CI green.Also as a reminder: what broke here is strictly an implementation detail. No interpretation of SemVer ever would bump their major version over this.
The workaround, for folks affected, is
pip install pip<22in the environment where you’re usingpip-tools.A similar occurrence happened when
pip21.3 was released last year: https://github.com/jazzband/pip-tools/issues/1503.On it there was some mention of making sure the
pip-toolsandpipmaintainers stay in sync when breaking changes are made. Since it seems thatpipis pretty liberal about refactoring their internals (which, to be clear, is their prerogative since it is internal) so that extra communication withpip-toolscould help.I wonder if this could be alleviated by moving the
pip-toolsproject under thepypaumbrella. One of the pypa’s most important products usespip-toolsso I would imagine they would see value in ensuring it stays in sync withpip. (As a side note, the fact thatwarehouseusespip-toolsand notpipenvis interesting, to say the least, considering thatpipenvis the officially recommended tool by the pypa…). This suggestion is mirroring the sentiment here.@RAbraham Or as commands, you need to either install pip-tools first and then downgrade pip, e.g.
pip install pip-tools; pip install 'pip<22'. Or just provide the limitation in the same commandpip install pip-tools 'pip<22'. But yes, it probably makes more sense to put the limitations into your dependency spec file.Please see https://github.com/jazzband/pip-tools/pull/1567 for a fix.
This fixed my build issues. Thanks for all your efforts everyone! Look forward to the patch.
I pushed a merge request that fixes the issue for me, but it’s failing tests.
https://github.com/jazzband/pip-tools/pull/1559
Hey, as a quickfix I’d suggest to simply change the assertion to cover
pip._internal.utils.logging.RichPipStreamHandleras well as the currently existing to have it running. This would decouple the current issue of people who want to have it working again from the discussion of pinning pip or how to use the internals. Feel free to leave comments at https://github.com/jazzband/pip-tools/pull/1565 if you like or dislike that idea.I think we may have to do more than
pip install pip<22? I just tried that but my next command to installpip-toolsdownloads pip 22 again?https://github.com/pypa/pip/issues/10726#issuecomment-1025206695: