Problem with CUDA 11.6 installation

SuperMonstor: <p>While installing torch with CUDA support from <a href="https://pytorch.org/get-started/locally/" rel="noopener nofollow ugc">here</a> I was facing an issue where there was a CUDA version mismatch even after running the command specified on the website.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/5/15c08907ba85d9cf06f71d1a96bc8944caef9805.png" data-download-href="https://discuss.pytorch.org/uploads/default/15c08907ba85d9cf06f71d1a96bc8944caef9805" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/5/15c08907ba85d9cf06f71d1a96bc8944caef9805_2_690x312.png" alt="image" data-base62-sha1="36qwYfhEO9F4q4PBKwB2Mvw0ZF3" width="690" height="312" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/5/15c08907ba85d9cf06f71d1a96bc8944caef9805_2_690x312.png, https://discuss.pytorch.org/uploads/default/optimized/3X/1/5/15c08907ba85d9cf06f71d1a96bc8944caef9805_2_1035x468.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/1/5/15c08907ba85d9cf06f71d1a96bc8944caef9805_2_1380x624.png 2x" data-dominant-color="F4DCD9"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1421×643 63.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<pre><code class="lang-auto">NVIDIA GeForce RTX 3070 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA GeForce RTX 3070 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

  warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
Could not do one pass in your dataloader, there is something wrong in it. Please see the stack trace below:
</code></pre>
<p>After a bit of tinkering around, I realized that the CUDA version from <code>torch.version.cuda</code> was actually 10.2 instead of the 11.6 that I had installed. I reinstalled using the Stable&gt;Linux&gt;Pip&gt;Python&gt;CUDA 11.6 command again just to make sure there wasn’t a mistake on my part, and installing using the 11.3 commands seems to have fixed it.</p>

ptrblck: <p>The error message points to a CUDA 10.2 runtime, which you’ve also confirmed.<br>
The install logs would show which binary will be installed and you either had the CUDA 10.2 PyTorch binary already installed or the install command was wrong.</p>
<p>I just reran the same command for the CUDA 11.6 runtime:</p>
<pre><code class="lang-auto">pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
</code></pre>
<p>and get:</p>
<pre><code class="lang-python">python -c "import torch; import torchvision; import torchaudio; print(torch.__version__); print(torchvision.__version__); print(torchaudio.__version__)"

1.12.0+cu116
0.13.0+cu116
0.12.0+cu116
</code></pre>

ashrest: <p>I tried upgrading my torch CUDA 10.2 to CUDA 11.6 using the command in the pytorch website. But when I check the cuda version using: torch.version cuda, the cuda version is still showing as 10.2.</p>

ptrblck: <p>You have either an older PyTorch installation in your current environment and would have to uninstall it or the command was wrong and the install logs showed that the default CUDA 10.2 runtime will be installed.<br>
In any case, try to create a new virtual environment, install the desired PyTorch version there, and make sure the install log in your terminal also shows CUDA 11.6.</p>