1

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

Ivan
  • 34,531
  • 8
  • 55
  • 100
YFrite
  • 13
  • 1
  • 1
  • 3

3 Answers3

5

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
    
Ivan
  • 34,531
  • 8
  • 55
  • 100
  • 2
    Thank you so much, I spent over 6 hours trying to install this library due to internet problems, but still, again, thanks more <3 – YFrite Sep 17 '21 at 08:48
  • I am using this command `conda install pytorch torchvision torchaudio cudatoolkit=11.3 matplotlib scipy opencv -c pytorch` which seems to be similar since it also installs cuda toolkit, but the pytorch version installed is the cpu only version. – knowledge_seeker Feb 17 '22 at 19:17
3

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

Ken Arnold
  • 1,942
  • 1
  • 20
  • 24
0

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
Arritmic
  • 474
  • 2
  • 12