Description
pip'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.