uv: Cannot install the CPU version of torch
I tried to install the CPU version of torch but could not.
uv pip install torch==2.1.0+cpu --find-links https://download.pytorch.org/whl/torch_stable.html
# and next command gives the same result.
uv pip install torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu
× No solution found when resolving dependencies:
╰─▶ Because there is no version of torch==2.1.0+cpu and you require torch==2.1.0+cpu, we can conclude that the requirements are unsatisfiable.
uv version: v0.1.2 Python 3.11.7 Ubuntu 20.4 X86_64 Architecture
By the way, the install of the GPU version of torch is successful.
uv pip install torch==2.1.0
# success
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 35 (15 by maintainers)
@charliermarsh do you have any plans to add support for the most common case?
uv pip install torch==2.1.0 --index-url https://download.pytorch.org/whl/cpuThe problem here is the behavior for installing CPU-only torch is different on arm64/aarch64 and x86_64/amd64 systems.
torch==x.x.x+cpuOn amd64,
On arm64, adding the
+cpufails & without it installs.uv has known limitations around local version identifiers but unsure why pip is able to make this work the way pytorch has documented https://pytorch.org/get-started/previous-versions/#v222 but uv can’t
Do you mind creating a new issue so that I remember to follow-up?
Perhaps it’s due to a lack of supported variants that they omitted the local identifier there? (here upstream PyTorch states they don’t intend to publish
aarch64variants with GPU accel)Reference
Using Docker from an AMD64 machine to test ARM64 environment:
You can kind of see why PyTorch has local identifier variants when comparing to PyPi?:
Resolve platform packaging inconsistency upstream
Maybe open an issue about it upstream since it seems to be more of a packaging concern unrelated to
uv?:https://github.com/pytorch/pytorch/issues/110791#issuecomment-1753334468
Which makes sense that CPU should be the default, with local identifiers only used for actual variants (eg: different cuda version support). Might introduce some friction to any existing CI perhaps, but you can see similar with nvidia’s own Docker images they publish where the naming convention isn’t always consistent 😅 (at least it broke a PyTorch docker build CI task recently)
Ops, sorry, I am on ARM macOS. You are right.
This works for me! py3.10 and latest
uv0.1.35.On the other hand, this raises:
EDIT: for this last command I also tried with the latest stable
uv, 0.1.39.Thanks @baskervilski - that makes sense to me actually (that it works), I believe the bug here relates to our handling of local versions which we’ll need to fix.
Ok, found a workaround(?), using the
--overrideoption:I created the
overrides.txtfile with the following contentThen called:
uv pip compile pyproject.toml -o requirements.txt --override overrides.txtanduv pip install -e . --override overrides.txtFor now I can live with this.
I got you fam 👌