Description
In #7744 we have decided to warn users when pip creates a dependency conflict when upgrading another package.
This issue is a proposal to change this behavior. This proposal is supported by user research, a summary of which will shortly be published on pip's docs.
What's the problem this feature will solve?
Currently, when a user asks pip to upgrade a package, it does this without considering what other packages are already installed. This can mean that pip can cause a dependency conflict.
This scenario (used in our user research) summarises the problem well:
Imagine you have package tea and coffee with the following dependencies:
tea 1.0.0 - depends on water<1.12
tea 2.0.0 - depends on water>=1.12
coffee 1.0.0 - depends on water<1.12
coffee 2.0.0 - depends on water>=1.12
You have the following packages installed:
tea 1.0.0
coffee 1.0.0
water 1.11.0
You ask pip to upgrade tea. What should pip do?
If pip upgrades tea to 2.0.0, water needs to be upgraded as well, creating a conflict with coffee...
Describe the solution you'd like
Pip should:
- Detect whether or not a conflict may occur, based on the packages that are already installed
- If a conflict is detected, pip should not install anything, and show an error message to the user
This reflects the most popular response to our research (71.7% of respondents) who said that pip should "Install nothing. Show an error explaining that the upgrade would cause incompatibilities."
Additional context
Example error message (happy to iterate on this as needed!)
ERROR: pip cannot upgrade tea, as this would introduce a dependency conflict:
you have water 1.11.0 installed
you have coffee 1.0.0 installed, requires water<1.12
tea 2.0.0 requires water>=1.12