YFrite
YFrite

Reputation: 13

torch.cuda.is_available() returns False why?

Has anyone encountered this?

I tried updating drivers and reinstalling cuda

Cuda Version: 11.4

GPU: GeForce RTX 3060 Laptop(6gb)

OS: Windows 10 home

torch.version: 1.9.0+cpu

Upvotes: 1

Views: 22594

Answers (3)

Ken Arnold
Ken Arnold

Reputation: 2013

For others who find this: torch.cuda.is_available() doesn't give any debugging information, but if you try to use CUDA anyway, you'll get a more informative error message:

>>> import torch
>>> torch.zeros(1).cuda()

Another answer with much more details: https://stackoverflow.com/a/61034368/69707

Upvotes: 5

Arritmic
Arritmic

Reputation: 509

If you have a different CUDA version than the offered in the command selection tool to install Pytorch, I recommend you to install the nightly binaries:

enter image description here

This worked for me having the cuda version 11.6:

pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu114

Upvotes: 0

Ivan
Ivan

Reputation: 40748

You are using a PyTorch version compiled for CPU, you should install the appropriate version instead:

  • Using conda:

    conda install pytorch torchvision cudatoolkit=11.1 -c pytorch -c conda-forge 
    
  • Using pip:

    python -m pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html
    

Upvotes: 5

Related Questions