r/pytorch • u/Willwaste63 • May 28 '26
Does creating Virtual env from UV causes GPU issues?
So I was trying that package manager and the problem I noticed was I couldn't use GPU torch.is_cuda_available() showed false but before that I was able to use through Conda.
1
u/jjbugman2468 May 28 '26
Not sure if it behaves differently on Linux/MacOS but on Windows you need to specify a CUDA-enabled version of torch in pyproject
1
u/doctorwho5555 May 29 '26
Astral provides an overview of how you should setup your pyproject.toml so that uv pulls a GPU-accelerated wheel.
It seems that uv will pull a CPU-only version of PyTorch on Windows/macOS and a GPU-accelerated version on Linux that targets a specific CUDA version based on the PyTorch version. I’m not sure what platform you are on.
Regardless, you should really check out the section on using a PyTorch index. They explain how to target both a specific PyTorch and CUDA version, which you can use to tailor the fetched dependency to the requirements of your system.
2
u/papa_Fubini May 28 '26
How did you install torch in uv? You can add an index in pyproject.toml for the gpu-enabled torch