UV 无法安装指定 CUDA 版本的 pytorch

298 天前
 Leon6868

命令:

uv pip install --verbose torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121

终端内容:

DEBUG uv 0.5.2 (195f4b634 2024-11-14)
DEBUG Searching for default Python interpreter in virtual environments
DEBUG Found `cpython-3.13.0-windows-x86_64-none` at `D:\xxx\.venv\Scripts\python.exe` (active virtual environment)     
DEBUG Using Python 3.13.0 environment at .venv
DEBUG Acquired lock for `.venv`
DEBUG At least one requirement is not satisfied: torchaudio==2.3.0
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.13.0
DEBUG Solving with target Python version: >=3.13.0
DEBUG Adding direct dependency: torch>=2.3.0, <2.3.0+
DEBUG Adding direct dependency: torchvision>=0.18.0, <0.18.0+
DEBUG Adding direct dependency: torchaudio>=2.3.0, <2.3.0+
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torch/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torchvision/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torchaudio/
DEBUG Searching for a compatible version of torch (>=2.3.0, <2.3.0+)
DEBUG Searching for a compatible version of torch (>=2.3.0, <2.3.0+cu121 | >2.3.0+cu121, <2.3.0+)
DEBUG No compatible version found for: torch
  × No solution found when resolving dependencies:
  ╰─▶ Because only the following versions of torch are available:
          torch<2.3.0
          torch>=2.3.0+cu121
      and torch==2.3.0+cu121 has no wheels with a matching Python ABI tag, we can conclude that torch==2.3.0 cannot be used.
      And because you require torch==2.3.0, we can conclude that your requirements are unsatisfiable.
DEBUG Released lock at `.venv\.lock`
1921 次点击
所在节点    Python
7 条回复
yuuluu
298 天前
换成 python 3.12
tolbkni
298 天前
你指定的 torch 2.3.0 版本的 wheel 包只兼容 Python 3.10/3.11/3.12

iorilu
298 天前
玩 python 永远不要用最新得版本

因为很多大型库跟不上更新得

保守点退回 1-2 个版本, 比如现在我一般用 3.11
akin520
298 天前
我用 3.10 3.11
hefish
298 天前
3.13 太新了吧。。。
llsquaer
298 天前
In my experience, use dual instead of single, but not the latest. Currently developing 3.10, 3.8 作为考古 win7 专用。

不知道为啥,输入框自动翻译成英文了。是那个插脚搞的鬼。
fghzpqm
297 天前
> At time of writing, PyTorch does not yet publish wheels for Python 3.13; as such projects with requires-python = ">=3.13" may fail to resolve. See the compatibility matrix.

https://docs.astral.sh/uv/guides/integration/pytorch/#installing-pytorch

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://ex.noerr.eu.org/t/1094644

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX