pythonpytorchgpu

Why does Pytorch-2.21 not detecting my GPU?


I got RTX 4060 with driver 560.76. I installed CUDA 11.8 and copied cuDNN 8.9.7. files to the correct directories in the CUDA installation folder. I added the right paths to the System variables Environment. Finally, created virtual environment and installed Pytorch 2.2.1 with torchaudio 2.2.1 and torchvision 0.17.1.

When I run this to check if Pytorch detect CUDA:

print(torch.cuda.is_available())

I get FALSE.

Same when I run

nvidia-smi

No running processes found 

In a different virtual environment, I use TensorFlow and it does defecting my GPU

What am I doing wrong?


Solution

  • Ok I was able to fix it by reinstalling the three libraries, specifying the CUDA version:

    pip install torch==2.2.1+cu118 torchvision==0.17.1+cu118 torchaudio==2.2.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html

    Close everything and rerun it from the beginning.