Skip to content

Warn users about dependency conflicts when updating other packages #7744

@uranusjr

Description

@uranusjr

This is a mental note on a topic I realise needing a discussion while working on another issue.

Say we have package foo and bar with the following dependencies:

foo 1.0.0
    six<1.12

foo 2.0.0
    six>=1.12

bar 1.0.0
    six<1.12

bar 2.0.0
    six>=1.12

Given an environment with the followings installed:

foo 1.0.0
bar 1.0.0
six 1.11.0

and the user runs pip install --upgrade foo. What should we do? If we upgrade foo to 2.0.0, six needs to be upgraded as well (as an intrinsic requirement), but now it would conflict with bar. I can think of three possibile approaches:

  1. Upgrade foo and six, and print an error/warning telling the user bar now has unsatisfied requirements.
  2. Upgrade bar automatically to 2.0.0.
  3. Telling the user everything is up-to-date, since the installed foo 1.0.0 is the latest version without conflicts.
  4. Error out without modifying the environment, saying the upgrade would introduce incompatibilities.

Approach 1 is the simplest, but might be too difficult for the user to notice (especially on CI). This is probably not a good idea if we can avoid it.

Approach 2 looks like a good idea at first glance, but IMO may be confusing to the user. The dependency graph would be much less complex in more than one way in practice, and it would be difficult for the user to notice, or understand why a seemingly unrelated package got upgraded.

Approach 3 is “correct” in thoery, but is as unuseful to the user as pip’s famous “No matching distributions found for” error. There is clearly a newer version to upgrade to from the user’s perspective. Why is pip not finding it? Open GitHub and file a bug report.

Approach 4 is the most reasonable to me. In the above example, pip would emit something like six>=1.12 (required by foo) would cause incompatibility in bar (requires six<1.12). The downside is pip would need to do more work to interpret the resolution result (this does not fit into the resolution process IMO).

Metadata

Metadata

Labels

C: dependency resolutionAbout choosing which dependencies to installUXUser experience relatedstate: needs discussionThis needs some more discussiontype: maintenanceRelated to Development and Maintenance Processes

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions