Reputation: 161
I installed Anaconda, CUDA, and PyTorch today, and I can't access my GPU (RTX 2070) in torch. I followed all of installation steps and PyTorch works fine otherwise, but when I try to access the GPU either in shell or in script I get
>>> import torch
>>> torch.cuda.is_available()
False
>>> torch.cuda.device_count()
0
>>> print(torch.version.cuda)
None
Running conda list
shows this as my installed package
cudatoolkit 11.3.1 h59b6b97_2
and running numba -s
in the conda environment shows
__CUDA Information__
CUDA Device Initialized : True
CUDA Driver Version : 11030
CUDA Detect Output:
Found 1 CUDA devices
id 0 b'NVIDIA GeForce RTX 2070' [SUPPORTED]
compute capability: 7.5
pci device id: 0
pci bus id: 1
Summary:
1/1 devices are supported
and all of the tests pass with ok
. CUDA 11.3 is one of the supported compute platforms for PyTorch and by my GPU and that is the version that I installed.
I already tried reinstalling CUDA, I am on Windows 10, nvcc --version
shows that CUDA is installed Build cuda_11.3.r11.3/compiler.29745058_0
Any suggestions would be helpful
Edit: I am using PyTorch 1.10 installed from the generated command on their website. Using python 3.9.7
. I also installed PyTorch again in a fresh conda environment and got the same problem.
Upvotes: 15
Views: 74910
Reputation: 31
As of Nov. 2024, the command to install Pytorch this way (take from site: https://pytorch.org/get-started/locally/) is:
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch-nightly -c nvidia
After install, the cuda can be detected.
Upvotes: 3
Reputation: 1565
For people coming to this in 2024, you can go to the Pytorch's get-started site and install the Preview (Nightly) version with CUDA 12.X
. It worked for me and some other people, according to this Bug thread on Github.
As of Feb. 2024, the command to install Pytorch this way (taken from the above mentioned site) is:
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia
Upvotes: 1
Reputation: 11
If you use conda, try to update conda. It works for me to install PyTorch 1.10 with CUDA 10.2.
Upvotes: 1
Reputation: 83
nvidia-smi
and see if it detects your GPU.Upvotes: 6
Reputation: 161
Downgrading CUDA to 10.2 and using PyTorch LTS 1.8.2 lets PyTorch use the GPU now. Per the comment from @talonmies it seems like PyTorch 1.10 doesn't support CUDA
Upvotes: 1