question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warn users about dependency conflicts when updating other packages

See original GitHub issue

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).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:61 (55 by maintainers)

github_iconTop GitHub Comments

2reactions
alexregcommented, Feb 17, 2021

What is the practical solution to https://github.com/pypa/pip/issues/9482 though? If I’m running pip3 install -U foo, then really I want it stop and warn me before upgrading if the upgrade would break a dependency. Only if I pass an --ignore-breakages option or something would I want it to go ahead. This is highly undesirable behaviour at present.

2reactions
jtamagnancommented, Oct 27, 2020

My apologies for giving an alternative that is wrong on all accounts. I hope thought that my confusion might help to show how the original message might be misinterpreted. Let me try a few more:

Warning: pip will upgrade foo. This may lead to foo’s dependencies being modified which may cause dependency conflicts.

Warning: pip will upgrade foo. This may lead to other packages being modified which may cause dependency conflicts.

If these don’t work hopefully my failure to find a better message does not mean that no one else will try to find one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix the upstream dependency conflict installing NPM ...
Probably one of your packages is outdated. Upgrading packages and fixing upgrade errors might fix the dependency conflict.
Read more >
Found conflicts between different versions of 'assembly ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >
How to Automatically Eliminate Dependency Hell
Wrestling with Dependency Hell? Understand how the ActiveState Platform can help you automatically resolve dependency conflicts.
Read more >
Dependency Resolution - pip documentation v22.3.1
This section provides practical suggestions to pip users who encounter a ResolutionImpossible error, where pip cannot install their specified packages due to ...
Read more >
Resolving Nuget dependency conflicts in Project SDK ...
Learn how to solve NU1107 and NU1608 errors and warnings when updating packages in Optimizely/Episerver projects in the Project SDK ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found