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

Misleading ResolutionImpossible error and strange backtracking behaviour for unsolveable requirements #13164

Open
1 task done
k-collie opened this issue Jan 13, 2025 · 0 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@k-collie
Copy link

Description

Strange backtracking behaviour and misleading ResolutionImpossible error when attempting to install unsolveable set of requirements.

Expected behavior

A more correct/useful error message. Potentially no strange backtracking behaviour.

pip version

pip-24.3.1, checked main too

Python version

3.12

OS

Linux

How to Reproduce

Create venv with updated pip:

python -m venv .venv-bug
source .venv-bug/bin/activate
pip install --upgrade pip

attempt install:

pip install --only-binary :all: "numpy>=2" scipy git+https://github.com/k-collie/pip-backtrack-bug-mre.git

This involves trying to install an unsolveable set of packages. numpy>=2 is specified however the pip-backtrack-bug-mre toy repository depends on numpy<2. The --only-binary :all: argument is not related, it just prevents attempting to compile many versions of scipy.

The bug is that pip attempts to backtrack scipy, despite the first scipy-1.15.1 version being compatible with numpy>=2. The error message then implies a conflict between scipy and numpy>=2, despite the true source of the conflict being between numpy>=2 and the toy repository.

To be clear, these requirements are not solveable, the problem is in pip's behaviour while attempting to solve them as well as the resulting error message.

See toy repository for working variations.

Output

Collecting git+https://github.com/k-collie/pip-backtrack-bug-mre.git
Cloning https://github.com/k-collie/pip-backtrack-bug-mre.git to /tmp/pip-req-build-rb_ft5g4
Running command git clone --filter=blob:none --quiet https://github.com/k-collie/pip-backtrack-bug-mre.git /tmp/pip-req-build-rb_ft5g4
Resolved https://github.com/k-collie/pip-backtrack-bug-mre.git to commit bd7ed6dd3afbaba593f2364c9cafcc2073d96cef
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting numpy>=2
Using cached numpy-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (62 kB)
Collecting scipy
Using cached scipy-1.15.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
INFO: pip is looking at multiple versions of pip-backtrack-bug-mre to determine which version is compatible with other requirements. This could take a while.
Using cached scipy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Using cached scipy-1.14.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached scipy-1.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached scipy-1.13.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached scipy-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached scipy-1.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
INFO: pip is looking at multiple versions of scipy to determine which version is compatible with other requirements. This could take a while.
Using cached scipy-1.11.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached scipy-1.11.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached scipy-1.11.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (59 kB)
ERROR: Cannot install numpy>=2, scipy==1.11.2, scipy==1.11.3, scipy==1.11.4 and scipy==1.12.0 because these package versions have conflicting dependencies.

The conflict is caused by:
The user requested numpy>=2
scipy 1.12.0 depends on numpy<1.29.0 and >=1.22.4
The user requested numpy>=2
scipy 1.11.4 depends on numpy<1.28.0 and >=1.21.6
The user requested numpy>=2
scipy 1.11.3 depends on numpy<1.28.0 and >=1.21.6
The user requested numpy>=2
scipy 1.11.2 depends on numpy<1.28.0 and >=1.21.6

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip to 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

@k-collie k-collie added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant