Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResolutionImpossible error message does not distinguish between extras #10873

Closed
1 task done
ZanSara opened this issue Feb 2, 2022 · 9 comments
Closed
1 task done
Labels
C: dependency resolution About choosing which dependencies to install C: error messages Improving error messages state: awaiting PR Feature discussed, PR is needed

Comments

@ZanSara
Copy link

ZanSara commented Feb 2, 2022

Description

If a package has extras with conflicting dependencies, the error message displayed by pip does not clarify which extras triggered the conflict, and also produces an error message with is rather confusing. Example (see steps to reproduce):

The conflict is caused by:
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas<2 and >=1.3
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas==1.4.1

This happens when extra1 asks for pandas==1.4.0 and extra2 asks for pandas==1.4.1. extra3 has nothing to do with the conflict, but from the error message it's impossible to tell. In addition, the error message never mentions neither which extras that caused the issue, nor the actual issue, as pandas==1.4.0 is never mentioned.

Expected behavior

It should point to the extras that triggered the ResolutionImpossible error in a clear way.

pip version

22.0.2

Python version

3.9

OS

Ubuntu 21.10

How to Reproduce

Create a setup.cfg with the following content:

[metadata]
name = resolution_impossible_with_extras

[options]
install_requires =
    pandas >=1.3, <2

[options.extras_require]
extra1 = 
    pandas==1.4.0
extra2 = 
    pandas==1.4.1
extra3 = 
    numpy==1.22.1

and an "empty" setup.py like the following content:

from setuptools import setup
setup()

Then execute in the same folder:

pip install .[extra1,extra2,extra3]

Output

Processing /path/to/folder/resolution-impossible-with-extras/package
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pandas<2,>=1.3 in /path/to/folder/resolution-impossible-with-extras/venv/lib/python3.9/site-packages (from resolution-impossible-with-extras==0.0.0) (1.4.0)
ERROR: Cannot install resolution-impossible-with-extras[extra1,extra2]==0.0.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas<2 and >=1.3
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas==1.4.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Code of Conduct

@ZanSara ZanSara added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Feb 2, 2022
@pradyunsg pradyunsg added C: dependency resolution About choosing which dependencies to install C: error messages Improving error messages state: awaiting PR Feature discussed, PR is needed and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Feb 2, 2022
@q0w
Copy link
Contributor

q0w commented Feb 3, 2022

Sometimes, pip provides the different output:

The conflict is caused by:
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas<2 and >=1.3
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas==1.4.0
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas==1.4.1

Its inconsistent, because Criterion object in failure_causes from resolvelib can contain 2 or 3 SpecifierRequirement objects

@ZanSara
Copy link
Author

ZanSara commented Feb 3, 2022

I haven't managed to get pip to output the message you show here. How did you obtain it?

@q0w
Copy link
Contributor

q0w commented Feb 3, 2022

Run it several times.

@q0w
Copy link
Contributor

q0w commented Feb 3, 2022

I also checked pip v21 and it also produced different outputs.

@notatallshaw
Copy link
Member

I also checked pip v21 and it also produced different outputs.

Seems this different output has been noticed in a couple of other issues #10824 and #10391 (comment)

@q0w
Copy link
Contributor

q0w commented Feb 3, 2022

logs:
1.txt
2.txt

@uranusjr
Copy link
Member

If anyone’s interested in improving this, see also #9237.

@notatallshaw
Copy link
Member

FYI the error message does now display the extra being refereed to, if you run on latest Pip you get:

The conflict is caused by:
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas<2 and >=1.3
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas==1.4.0; extra == "extra1"
    resolution-impossible-with-extras[extra1,extra2,extra3] 0.0.0 depends on pandas==1.4.1; extra == "extra2"

@notatallshaw
Copy link
Member

Closing as this now appears to be fixed and there was no further feedback. Feel free to open a new issue if there is a new way of reproducing the problem.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: dependency resolution About choosing which dependencies to install C: error messages Improving error messages state: awaiting PR Feature discussed, PR is needed
Projects
None yet
Development

No branches or pull requests

5 participants