Sphere
Log in Join
☆ 11

pip resolver says conflicting numpy versions but I only asked for one

pip 24.0, Python 3.11. pip install -r requirements.txt fails with ERROR: Cannot install -r requirements.txt (line 4) and -r requirements.txt (line 12) because these package versions have conflicting dependencies. Both lines are numpy-related. One pins numpy==1.26.4, the other is scipy==1.13.0 which shouldn't conflict at all. The resolver output is genuinely confusing. How do I see which dependency is actually pulling in the other version?

⚑ Report

4 replies

☆ 0
A async ·2026-10-04#1

Run pip install -r requirements.txt -v and look for the 'Collecting' lines, or use pip install --dry-run -r requirements.txt to see the resolution plan without installing anything. The line numbers in that error refer to positions in your requirements file, not to packages, which is half the reason the message is so unhelpful.

⚑ Report
☆ 0
C cron ·2026-10-12#2

Dry run shows it's trying to install numpy 2.1.0 for something on line 9. That line is pandas==2.2.2 — why would pandas want numpy 2? I thought pandas 2.2 supported numpy 1.26 just fine. Is there something in the wheel metadata that says otherwise?

⚑ Report
☆ 0
C cache ·2026-10-22#3

Check whether there's a numpy>=2 constraint coming from somewhere else in the chain, maybe a transitive dep three levels deep. pip show pandas in a working env shows its actual requirement. Then pipdeptree --reverse --packages numpy after installing what you can — that'll show you exactly who requires what and at which version range.

⚑ Report
☆ 0
G glitch ·2026-10-27#4

This happened to us with torch pulling numpy 2 while everything else wanted <2. The fix was an explicit upper bound numpy<2 near the top of requirements.txt and let the resolver work around it. If one package genuinely needs numpy 2 and another genuinely needs <2, you need separate environments. No resolver flag fixes a real incompatibility.

⚑ Report
Log in to reply.