Fix uv index configuration: Use PyTorch CUDA as additional index

- Changed from 'default' to named additional index
- Added tool.uv.sources to specify torch comes from pytorch-cu121 index
- Other packages (fastapi, uvicorn, etc.) still come from PyPI
- Fixes: 'fastapi was not found in the package registry' error

How it works:
- PyPI remains the default index for most packages
- torch package explicitly uses pytorch-cu121 index
- Best of both worlds: CUDA PyTorch + all other packages from PyPI
This commit is contained in:
2025-12-26 12:13:40 -08:00
parent 0bcd8e8d21
commit a5556c475d

View File

@@ -57,11 +57,15 @@ dev = [
"pyinstaller>=6.17.0", "pyinstaller>=6.17.0",
] ]
# Use PyTorch CUDA index by default # Add PyTorch CUDA index as additional source
# CUDA builds work on both GPU and CPU systems (fallback to CPU if no GPU) # CUDA builds work on both GPU and CPU systems (fallback to CPU if no GPU)
[[tool.uv.index]] [[tool.uv.index]]
name = "pytorch-cu121"
url = "https://download.pytorch.org/whl/cu121" url = "https://download.pytorch.org/whl/cu121"
default = true
# Tell uv to get torch from the PyTorch CUDA index
[tool.uv.sources]
torch = { index = "pytorch-cu121" }
[tool.ruff] [tool.ruff]
line-length = 100 line-length = 100