pip needs a dependency resolver
See original GitHub issuepip’s dependency resolution algorithm is not a complete resolver. The current resolution logic has the following characteristics:
- Only one top level specification of a requirement (otherwise pip raises a “double requirement” exception)
- “first found wins” behavior for dependency requirements/constraints, which results in not respecting all constraints. pip 10+ print a warning when this occurs.
NOTE: In cases where the first found dependency is not sufficient, specifying the constraints for the dependency on the top level can be used to make it work.
pip install project "dependency>=1.5,<2.0"
(2019-06-23)
This is being worked on by @pradyunsg, in continuation of his GSoC 2017 project. A substantial amount of code cleanup has been done, and is ongoing, to make it tractable replace the current resolver, in a reasonable manner. This work enabled pip >= 10 to warn when it is going to make an installation that breaks the dependency graph. (The installations are not aborted in such scenarios, for backwards compatibility.)
(2019-11-29)
A status update regarding this is available here.
(2022-12-16)
See the closing note for details.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:390
- Comments:179 (91 by maintainers)
Top GitHub Comments
That felt goooood. 😃
Hey everyone! Hope you’ve had a great start to 2018!
This issue has been quiet for a while now and I have stuff worth telling. 😃
There’s a branch of pip that is capable of printing a warning when an incompatible set of packages is going to be installed. I’m not completely sure if the UX is good enough, so I’m seeking input on this behaviour; whether it is indeed something that would be an improvement over the status quo, what can be potential improvements to it etc. I’d appreciate any feedback on it over on https://github.com/pradyunsg/pip/issues/1.
As for proper resolution, all the preparatory refactoring that was needed on pip’s side is basically done (it’s what made the validation stuff mentioned above much easier to do). It was much more work than I’d anticipated initially.
I’m working on the resolver separately now and will bring it into pip once it’s ready. What has been implemented currently already handles whatever I’ve thrown at it yet, including interesting situations with cycles and optional dependencies (extras). If you have a situation where pip 9’s resolver does the wrong thing or causes issues, I’d really appreciate it if you could file an issue over at the zazo, detailing the project and versions involved to help make sure that zazo’s resolver will Do The Right Thing™ (especially if there’s a large number of projects and versions).
Cheers!
edit: Look, 100th comment!