uv: `uv pip install` resolution fails whereas `pip install` has no issues
Summary
Somewhat unexpectedly, uv is under-performing and failing whereas standard pip works fine
MRE
python 3.10.6
uv 0.6.3
requirements.txt:
numpy
umap-learn
pip install -r requirements.txt ✅
pip list:
Package Version
------------- -------
joblib 1.4.2
llvmlite 0.44.0
numba 0.61.0
numpy 2.1.3
pip 25.0
pynndescent 0.5.13
scikit-learn 1.6.1
scipy 1.15.2
setuptools 75.8.0
threadpoolctl 3.5.0
tqdm 4.67.1
umap-learn 0.5.7
wheel 0.45.1
whereas trying instead with
uv pip install -r requirements.txt ❌ - fails
in addition, if you were to try after the successful pip install in --dry-run, you get suggestions to downgrade packages (numba?..)
uv pip install -r requirements.txt --upgrade --dry-run:
Resolved 11 packages in 39ms
Would download 4 packages
Would uninstall 4 packages
Would install 4 packages
- llvmlite==0.44.0
+ llvmlite==0.36.0
- numba==0.61.0
+ numba==0.53.1
- numpy==2.1.3
+ numpy==2.2.3
- setuptools==75.8.0
+ setuptools==75.8.2
even more odd is that you can overcome this by pinning umap-learn explicitly to the latest version in the requirements.txt file, so having the following instead works:
numpy
umap-learn==0.5.7
Platform
Ubunutu 24.04
Version
uv 0.6.3
Python version
Python 3.10.6
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 20 (9 by maintainers)
Commits related to this issue
- Prioritize unspecified over conflict late For #12060 — committed to astral-sh/uv by konstin 2 years ago
- Wrong backtracking scenario with an indirection MRE and explanantion for https://github.com/astral-sh/uv/issues/12060 and https://github.com/astral-sh/uv/issues/12126. This currently doesn't pass in... — committed to astral-sh/packse by konstin 2 years ago
- Wrong backtracking scenario with an indirection MRE and explanantion for https://github.com/astral-sh/uv/issues/12060 and https://github.com/astral-sh/uv/issues/12126. This currently doesn't pass in... — committed to astral-sh/packse by konstin 2 years ago
- Wrong backtracking scenario with an indirection MRE and explanantion for https://github.com/astral-sh/uv/issues/12060 and https://github.com/astral-sh/uv/issues/12126. This currently doesn't pass in... — committed to astral-sh/packse by konstin 2 years ago
- build: add constraint for `numba` version until astral-sh/uv/issues/12060 is fixed — committed to ma-sadeghi/poromics by ma-sadeghi 2 years ago
- build: add numba as dependency until astral-sh/uv/issues/12060 is fixed — committed to ma-sadeghi/poromics by ma-sadeghi 2 years ago
- Wrong backtracking scenario with an indirection (#239) MRE and explanation for https://github.com/astral-sh/uv/issues/12060 and https://github.com/astral-sh/uv/issues/12126. This currently resolves ... — committed to astral-sh/packse by konstin a year ago
Yeah I presume it’s correct that it requires
llvmlitebut the lack of constraints leading to the finally selected version is quite misleading.If you reverse the order of the dependencies, we’ll solve this as expected
As Charlie noted, this is a backtracking prioritizing issue. The resolution is “valid” but not ideal. Some details about that idea in https://docs.astral.sh/uv/concepts/resolution/#basic-examples and https://github.com/astral-sh/uv/issues/8157
I’m wondering if there needs to be better documentation here? Or error hints?
Looking at the error:
There are two directions you can appraoch this problem:
:allfor all pacakges):llvmlite>0.36.0and thennumba>0.53.1There are probably better heuristics uv can do here, but there’s no way to get this right 100% of the time, pip also will need to be directed like this at times.
In general you want binary packages, especially for datascience packages, I personally have
--only-binary :all:set and then--no-binary <package_name>for packages that have no wheel available.We’re backtracking to a different
llvmliteversion vianumba. It’s probably due to an interaction withnumpyand we probably try to solve the pinned version first same as when I moved it to the top of the requirements file. The resolver heuristics are sort of complicated.My guess is that the hint is right, but there are multiple constraints / paths to the dependency and we’re only showing one? I think we’re just backtracking here in a way that leads to a build failure. It’s not necessarily “wrong” but it’s sub-optimal.