Torch.cuda.is_available() is false CUDA Version: 11.4

adrilang: <p>Dear all,</p>
<p>I know that the question has been asked already several times, but the answers given seem not to help in my case. I cannot us cuda in my python scripts, I get torch.cuda.is_available() == False. I have installed pytorch and the cuda_toolkit using the following command:<br>
conda install pytorch torchvision torchaudio cudatoolkit=11.4 -c pytorch -c nvidia</p>
<p>My output of nvidia-smi is:<br>
±----------------------------------------------------------------------------+<br>
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |<br>
|-------------------------------±---------------------±---------------------+<br>
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |<br>
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |<br>
|                               |                      |               MIG M. |<br>
|===============================+======================+======================|<br>
|   0  NVIDIA GeForce …  On   | 00000000:01:00.0 Off |                  N/A |<br>
| 30%   45C    P8    41W / 420W |    163MiB / 24259MiB |      0%      Default |<br>
|                               |                      |                  N/A |<br>
±------------------------------±---------------------±---------------------+<br>
|   1  NVIDIA GeForce …  On   | 00000000:21:00.0 Off |                  N/A |<br>
| 30%   46C    P8    16W / 350W |      5MiB / 24268MiB |      0%      Default |<br>
|                               |                      |                  N/A |<br>
±------------------------------±---------------------±---------------------+<br>
|   2  NVIDIA GeForce …  On   | 00000000:4C:00.0 Off |                  N/A |<br>
| 30%   38C    P8    20W / 350W |      5MiB / 24268MiB |      0%      Default |<br>
|                               |                      |                  N/A |<br>
±------------------------------±---------------------±---------------------+</p>
<p>±----------------------------------------------------------------------------+<br>
| Processes:                                                                  |<br>
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |<br>
|        ID   ID                                                   Usage      |<br>
|=============================================================================|<br>
|    0   N/A  N/A      1741      G   /usr/lib/xorg/Xorg                138MiB |<br>
|    0   N/A  N/A      2360      G   cinnamon                           23MiB |<br>
|    1   N/A  N/A      1741      G   /usr/lib/xorg/Xorg                  4MiB |<br>
|    2   N/A  N/A      1741      G   /usr/lib/xorg/Xorg                  4MiB |<br>
±----------------------------------------------------------------------------+<br>
Thanks in advance for any help</p>

AlphaBetaGamma96: <p>It’d be best to get a dev’s opinion on this, but I believe pytorch only supports up to 11.1 as can be seen on their install page, <a href="https://pytorch.org/get-started/locally/" class="inline-onebox" rel="noopener nofollow ugc">Start Locally | PyTorch</a> . So, perhaps it’s not supported yet?</p>
<p>I’ve just checked mine, and I’m running with CUDA version 11.2! (which works) So, maybe that’s the most recent supported version</p>

adrilang: <p>Thanks for your answer.<br>
I’ve tried the 11.1 version and even if it don’t matches the version on my Nvidia GPU the problem is now solved.</p>

Alex_Costea: <p>While I’m still learning about these versions - the Nvidia GPU version of CUDA must not be confused with the compatible version with PyTorch. You can look at the CUDA version for the GPU as the best allowed version.</p>
<p>Does your GPU support up to x.x version of CUDA? Then use the y.y PyTorch compatible version of CUDA up to that x.x version.</p>

kaustubh: <p>Hello, I upgraded nvidia-driver today. This are the driver details:<br>
NVIDIA-SMI 470.82.00    Driver Version: 470.82.00    CUDA Version: 11.4</p>
<p>the pytorch setup with cu113 is working and shows cuda.is_available as True.</p>

CaptainCreideiki: <p>JFYI, nvidia-smi gives you a highest version of cuda which is supported by GPU.<br>
use nvcc -V command for a version that is running actually.</p>

eqy: <p>I believe <code>nvidia-smi</code> indicates the driver install version and CUDA version packaged with the driver. Note that the version used by PyTorch is determined by what CUDA version is packaged with the PyTorch binaries.</p>

Sudharsan_Madhavan: <p>This saved me! On my computer, nvidia-smi returned 11.4 and I kept trying torch 11.3 but it didn’t use GPU. nvcc -V gave me 10.2 and installing torch 10.2 works great! Thanks!</p>