Cuda works on Numba but not on Torch

Hi all,

I am a bit new to torch and have only used it on VMs before. I am now trying to use it on my computer and it doesn’t seem to be working.

When I print(pycuda.driver.Device.count()) I get 1, however when I print(torch.cuda.is_available()) I get None.

I tried reinstalling both torch and cuda and I still get this issue. Can anyone point me in the right direction?

You might have installed the CPU-only binary of PyTorch. Could you check what print(torch.version.cuda) returns?

That releases None. Could you point me to how to install a GPU version of PyTorch? I tried uninstalling and reinstalling a cuda version, but I’m unsure if I am entirely cleaning PyTorch.

Thanks for the update as it confirms you’ve installed the CPU-only binary.
Refer the these install instructions, select the desired CUDA runtime (11.7 or 11.8), copy/paste the install command, and make sure the PyTorch binary indicates the CUDA version in its name.
Also, I would recommend installing PyTorch into a clean and empty environment to avoid conflicts with already installed PyTorch versions.
E.g. for 2.0.0+cu117 a simple pip install torch would work.

Sorry for the late reply, but that has worked. Thank you so much!