Search code examples
windowspytorch

I have a GPU and CUDA installed in Windows 10 but Pytorch's torch.cuda.is_available() returns false; how can I correct this?


I have PyTorch installed on a Windows 10 machine with a Nvidia GTX 1050 GPU. I have installed the CUDA Toolkit and tested it using Nvidia instructions and that has gone smoothly, including execution of the suggested tests.

However, torch.cuda.is_available() returns False. How can I fix this?


Solution

  • I also had the same issue. And running this => a=torch.cuda.FloatTensor(), gave the assertion error AssertionError: Torch not compiled with CUDA enabled . ...which kind of cleared that i was running pytorch without cuda.

    Steps:

    1. Make sure you have un-installed Pytorch by invoking the following command:

      pip uninstall torch

    2. Go to https://pytorch.org/get-started/locally/ and select your system configurations(as shown in the figure).

    3. Copy the exact command from the Run this command dialog and run it on your terminal.

    enter image description here