My pytorch-cuda version is 11.6 in my conda environment and I have installed CUDA 11.3

Aileen: <p>Dear All,</p>
<p>I have been struggling to get run my PyTorch on GPU. I am new to this hence might be doing something wrong:</p>
<p>C:\Users\axs0959&gt;nvidia-smi<br>
Sun Jan 15 23:19:21 2023<br>
±----------------------------------------------------------------------------+<br>
| NVIDIA-SMI 465.89       Driver Version: 465.89       CUDA Version: 11.3     |<br>
|-------------------------------±---------------------±---------------------+<br>
| GPU  Name            TCC/WDDM | 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 … WDDM  | 00000000:01:00.0  On |                  N/A |<br>
| 33%   57C    P0    79W / 250W |    870MiB / 11264MiB |      0%      Default |<br>
|                               |                      |                  N/A |<br>
±------------------------------±---------------------±---------------------+</p>
<p>(ailab) C:\Users\axs0959&gt;nvcc --version<br>
nvcc: NVIDIA (R) Cuda compiler driver<br>
Copyright (c) 2005-2022 NVIDIA Corporation<br>
Built on Tue_Mar__8_18:36:24_Pacific_Standard_Time_2022<br>
Cuda compilation tools, release 11.6, V11.6.124<br>
Build cuda_11.6.r11.6/compiler.31057947_0</p>
<blockquote>
<blockquote>
<blockquote>
<p>import torch<br>
print(torch.version.cuda)<br>
None<br>
print(torch.cuda.is_available())<br>
False<br>
print(torch.cuda.device_count())<br>
0</p>
</blockquote>
</blockquote>
</blockquote>
<p>I have installed the CUDA and cudnn on Windows 10. I have set the environment variables, restarted my computer and I know that I am missing something.</p>
<p>Thanks,<br>
Aileen</p>

ptrblck: <aside class="quote no-group" data-username="Aileen" data-post="1" data-topic="170342">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/b5a626/48.png" class="avatar"> Aileen:</div>
<blockquote>
<p>print(torch.version.cuda)<br>
None</p>
</blockquote>
</aside>
<p>This indicates that you’ve installed the CPU-only PyTorch binary without a CUDA runtime.<br>
Use the install commands from <a href="https://pytorch.org/get-started/locally/">here</a> and make sure the install log shows that the right binary is selected.</p>

Aileen: <p>Hello,</p>
<p>I actually did try it a couple of times and due to some unknown reason after selecting this query:</p>
<p>conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia</p>
<p>I get this:</p>
<h2>
<a name="package-plan-1" class="anchor" href="#package-plan-1"></a>Package Plan</h2>
<p>environment location: C:\Users\axs0959\Anaconda3\envs\ailab</p>
<p>added / updated specs:<br>
- pytorch<br>
- pytorch-cuda=11.6<br>
- torchaudio<br>
- torchvision</p>
<p>The following packages will be UPDATED:</p>
<p><strong>pytorch                               1.12.1-py3.10_cpu_0 → 1.13.1-py3.10_cpu_0</strong><br>
torchaudio                               0.12.1-py310_cpu → 0.13.1-py310_cpu<br>
torchvision                              0.13.1-py310_cpu → 0.14.1-py310_cpu</p>
<p>Do you recommend I uninstall PyTorch completely for this environment and start fresh?</p>

Aileen: <p>Hello,</p>
<p>Although the popular belief was that once the torch in uninstalled, it does create problems during installation, I went ahead and installed it.</p>
<p>Here is the outcome:</p>
<blockquote>
<blockquote>
<blockquote>
<p>print(torch.version.cuda)<br>
11.6<br>
print(torch.cuda.is_available())<br>
True<br>
print(torch.cuda.device_count())<br>
1<br>
print(torch.cuda.device_name)<br>
Traceback (most recent call last):<br>
File “”, line 1, in <br>
AttributeError: module ‘torch.cuda’ has no attribute ‘device_name’. Did you mean: ‘get_device_name’?<br>
print(torch.cuda.get_device_name())<br>
NVIDIA GeForce GTX 1080 Ti</p>
</blockquote>
</blockquote>
</blockquote>
<p>The lesson learned here is that if this issue occurs then use:</p>
<p>conda uninstall pytorch</p>
<p>to uninstall the pytorch version from the environment otherwise, if you try to reinstall with the new command, in case you have accidentally installed the CPU version, the environment will just get updated with the latest version of the same <strong>pytorch 1.12.1-py3.10_cpu_0</strong> or whichever version you have and you would still have the pytorch CPU version.</p>
<p>Thanks for the advice.<br>
Aileen</p>