mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Backtrack to non-local versions when wheels are missing platform support (#10046)
## Summary This is yet another variation on https://github.com/astral-sh/uv/pull/9928, with a few minor changes: 1. It only applies to local versions (e.g., `2.5.1+cpu`). 2. It only _considers_ the non-local version as an alternative (e.g., `2.5.1`). 3. It only _considers_ the non-local alternative if it _does_ support the unsupported platform. 4. Instead of failing, it falls back to using the local version. So, this is far less strict, and is effectively designed to solve PyTorch but nothing else. It's also not user-configurable, except by way of using `environments` to exclude platforms.
This commit is contained in:
parent
f3c5b63095
commit
2c68dfd4a9
9 changed files with 1206 additions and 143 deletions
|
@ -114,16 +114,13 @@ Next, update the `pyproject.toml` to point `torch` and `torchvision` to the desi
|
|||
|
||||
=== "CPU-only"
|
||||
|
||||
PyTorch doesn't publish CPU-only builds for macOS, since macOS builds are always considered CPU-only.
|
||||
As such, we gate on `platform_system` to instruct uv to ignore the PyTorch index when resolving for macOS.
|
||||
|
||||
```toml
|
||||
[tool.uv.sources]
|
||||
torch = [
|
||||
{ index = "pytorch-cpu", marker = "platform_system != 'Darwin'"},
|
||||
{ index = "pytorch-cpu" },
|
||||
]
|
||||
torchvision = [
|
||||
{ index = "pytorch-cpu", marker = "platform_system != 'Darwin'"},
|
||||
{ index = "pytorch-cpu" },
|
||||
]
|
||||
```
|
||||
|
||||
|
@ -201,10 +198,10 @@ dependencies = [
|
|||
|
||||
[tool.uv.sources]
|
||||
torch = [
|
||||
{ index = "pytorch-cpu", marker = "platform_system != 'Darwin'" },
|
||||
{ index = "pytorch-cpu" },
|
||||
]
|
||||
torchvision = [
|
||||
{ index = "pytorch-cpu", marker = "platform_system != 'Darwin'" },
|
||||
{ index = "pytorch-cpu" },
|
||||
]
|
||||
|
||||
[[tool.uv.index]]
|
||||
|
@ -290,11 +287,11 @@ conflicts = [
|
|||
|
||||
[tool.uv.sources]
|
||||
torch = [
|
||||
{ index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
|
||||
{ index = "pytorch-cpu", extra = "cpu" },
|
||||
{ index = "pytorch-cu124", extra = "cu124" },
|
||||
]
|
||||
torchvision = [
|
||||
{ index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
|
||||
{ index = "pytorch-cpu", extra = "cpu" },
|
||||
{ index = "pytorch-cu124", extra = "cu124" },
|
||||
]
|
||||
|
||||
|
@ -311,9 +308,8 @@ explicit = true
|
|||
|
||||
!!! note
|
||||
|
||||
Since GPU-accelerated builds aren't available on macOS, the above configuration will continue to use
|
||||
the CPU-only builds on macOS via the `"platform_system != 'Darwin'"` marker, regardless of the extra
|
||||
provided.
|
||||
Since GPU-accelerated builds aren't available on macOS, the above configuration will fail to install
|
||||
on macOS when the `cu124` extra is enabled.
|
||||
|
||||
## The `uv pip` interface
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue