NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation

akslduk: <p>Hello, I’m getting following error:<br>
NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation.<br>
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.<br>
If you want to use the NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at <a href="https://pytorch.org/get-started/locally/" class="inline-onebox" rel="noopener nofollow ugc">Start Locally | PyTorch</a></p>
<p>I’ve tried to install compatible version but I don’t think I’m doing it correctly. Can anyone help me to get it installed correctly?</p>
<pre><code class="lang-auto">$ python3 -m pip list | grep torch
torch                   1.10.1              
torchvision             0.11.2
</code></pre>
<pre><code class="lang-auto">$ which pip3
/usr/bin/pip3
</code></pre>
<p><code>CUDA Version                              : 11.4</code></p>

ptrblck: <p>You’ve most likely installed the binaries with the CUDA10.2 runtime, which is incompatible with your 3090. Install the pip wheels or conda binaries with CUDA11 and it should work.</p>

dbish: <p>Can you clarify why you tagged torchx? It doesn’t seem like you are <a href="https://pytorch.org/torchx/latest/" rel="noopener nofollow ugc">using it</a>, but I want to make sure that is the case.</p>

akslduk: <p>Yes, you are right. Did mistake. I’ve fixed it. It works now. Thanks for replying.</p>

pakdaman: <p>I am facing the exact error. Following your advice I did the following:</p>
<ul>
<li>To install cuda 11 I used following command:<br>
sudo sh cuda_11.4.0_470.42.01_linux.run --toolkit --silent --override</li>
</ul>
<p>And I confirm to see the following when I use nvcc -V linux command:</p>
<p>nvcc: NVIDIA (R) Cuda compiler driver<br>
Copyright (c) 2005-2021 NVIDIA Corporation<br>
Built on Wed_Jun__2_19:15:15_PDT_2021<br>
Cuda compilation tools, release 11.4, V11.4.48<br>
Build cuda_11.4.r11.4/compiler.30033411_0</p>
<ul>
<li>To install a compatible torch for the installed cudatoolkit I used following pip command<br>
pip3 install torch==1.9.0 -f <a href="https://download.pytorch.org/whl/cu114/torch_stable.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu114/torch_stable.html</a>
</li>
</ul>
<p>However, I still get the above error! I am wondering if you might have any advice/comment?<br>
Thanks</p>

ptrblck: <p><code>https://download.pytorch.org/whl/cu114/torch_stable.html</code> doesn’t seem to be a valid URL so I guess you might have installed the (default) CUDA10.2 wheels?<br>
What did the install log show and what does <code>torch.version.cuda</code> as well as <code>torch.cuda.get_arch_list()</code> return?</p>

pakdaman: <p>Many thanks <a class="mention" href="/u/ptrblck">@ptrblck</a> for quick response and the smart suggestions. You are correct! Here is the output of the two commands</p>
<blockquote>
<blockquote>
<blockquote>
<p>torch.cuda.get_arch_list()<br>
[‘sm_37’, ‘sm_50’, ‘sm_60’, ‘sm_70’]<br>
torch.version.cuda<br>
‘10.2’</p>
</blockquote>
</blockquote>
</blockquote>
<p>apparently the cuda version used by torch is still 10.2<br>
I uninstalled the torch and installed the pip3 command using this valid link instead :<a href="https://download.pytorch.org/whl/cu113/torch_stable.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu113/torch_stable.html</a></p>
<p>However, I still note that the torch.version.cuda returns ‘10.2’ ! while both nvidia-smi and nvcc -V both are cuda 11 ! could it be because I have different versions of cuda toolkit installed (btw, I have the link to the latest in my PATH and LD_LIBRARY_PATH)</p>

ptrblck: <aside class="quote no-group" data-username="pakdaman" data-post="7" data-topic="141940">
<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/p/0ea827/48.png" class="avatar"> pakdaman:</div>
<blockquote>
<p>could it be because I have different versions of cuda toolkit installed (btw, I have the link to the latest in my PATH and LD_LIBRARY_PATH)</p>
</blockquote>
</aside>
<p>No, since the pip wheels and conda binaries ship with their own CUDA runtime. Your local CUDA toolkit will be used if you are building PyTorch from source or a custom CUDA extension.<br>
Run the uninstall command a few times until <code>pip</code> and <code>conda</code> don’t find any PyTorch installations anymore and verify it via <code>pip list | grep torch</code> and <code>conda list | grep torch</code>. Then reinstall the correct wheels again. Alternatively, create a new virtual environment and install the CUDA11 wheels there.</p>

pakdaman: <p><a class="mention" href="/u/ptrblck">@ptrblck</a>, many thanks  for your help.<br>
Confirming that the problem resolved by:<br>
1- creating new conda env<br>
2- installing pytorch 1.9.0 with cuda 11.1 wheel</p>

Nasr: <p>hello<br>
i trained by pytorch before<br>
but today try to train on RTX 3090 with cuda 11.7<br>
when i import torch and use this code “torch.cuda.get_device_properties(‘cuda’)” and get this error:<br>
NVIDIA GeForce RTX 3090 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.</p>
<p>downgrade cuda to 11.6 but still not working.<br>
use anaconda now working but at the end of train get error "AttributeError: ‘NoneType’ object has no attribute ‘_free_weak_ref’ "<br>
has anyone found the solution to solve this problem?</p>

ptrblck: <aside class="quote no-group" data-username="Nasr" data-post="10" data-topic="141940">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nasr/48/45997_2.png" class="avatar"> Nasr:</div>
<blockquote>
<p>but today try to train on RTX 3090 with cuda 11.7</p>
</blockquote>
</aside>
<p>I guess you built PyTorch from source using a local CUDA toolkit? If so, then you have set the wrong GPU architectures for this build as <code>sm_86</code> is missing.<br>
The pip wheels and conda binaries with the 11.7 CUDA runtime are still <a href="https://github.com/pytorch/builder/issues/1042">work in progress</a> and I’m currently adding the <code>manywheel</code> builds.<br>
In case you tried to “build” the CUDA 11.7 binary URL, note that it would install the default wheel with CUDA 10.2 and would explain the error.</p>

Nasr: <p>dear Ptrblck<br>
normally i install CUDA from <a href="https://developer.nvidia.com/cuda-downloads" class="inline-onebox" rel="noopener nofollow ugc">CUDA Toolkit 11.7 Downloads | NVIDIA Developer</a> and also use archive for old version also use pip because have problem with conda and ROS system<br>
so set virtualenv and source it to install Pkgs<br>
until now i never config GPU architecture and it works maybe it set automatically.<br>
normally i use cuda 11.6 and it work for nvidia version 510.47.3<br>
but on this system i can’t install nvidia version 510.47.3 and its version is 510.73.5 i dont know is the cuda 11.6 works on this version or not<br>
at the end i want to find my mistake that makes these error.<br>
thanks</p>

ptrblck: <p>If I understand you correctly, you are not building from source but are installing the pip wheels.<br>
Note that in this case the local CUDA toolkit won’t be used unless you are building a custom CUDA extension (or PyTorch from source of course).<br>
Given the error message you have most likely installed PyTorch with the CUDA 10.2 runtime, which is too old for your Ampere GPU.<br>
Use the CUDA 11 runtime via:</p>
<pre><code class="lang-python">pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
</code></pre>
<p>and it should work (make sure to uninstall the old binaries before installing the new one).</p>

Nasr: <p>i install “torch and torchvision” by this code from yoloV5 requirement  “pip install -r requirement”<br>
torch&gt;=1.7.0<br>
torchvision&gt;=0.8.1</p>
<p>if i understand you tell me to remove all of cuda and torch and torchvision<br>
then install cuda 11.6 from nvidia developer<br>
and at the end install the torch and torchvision from <a href="https://download.pytorch.org/whl/cu113" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu113</a> as u said</p>

ptrblck: <aside class="quote no-group" data-username="Nasr" data-post="14" data-topic="141940">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nasr/48/45997_2.png" class="avatar"> Nasr:</div>
<blockquote>
<p>if i understand you tell me to remove all of cuda and torch and torchvision<br>
then install cuda 11.6 from nvidia developer</p>
</blockquote>
</aside>
<p>No, keep your local CUDA toolkit (11.7) and just uninstall the PyTorch pip wheels.<br>
Then install the PyTorch pip wheel with the CUDA 11.3 runtime (your local CUDA 11.7 toolkit won’t be used to run the pip wheels and can stay).</p>

Nasr: <p>i can’t understand with the pip wheels<br>
do you mean <a href="https://pypi.org/project/pytorch-wheel-installer/" class="inline-onebox" rel="noopener nofollow ugc">pytorch-wheel-installer · PyPI</a> ?<br>
python env use local cuda and installation save into lib folder<br>
as i understand you tell me i can install pytorch with and other cuda runtime<br>
and it works.<br>
i have another problem with training after use conda and fix problem and try i got this error<br>
<a href="https://github.com/ultralytics/yolov5/issues/7339" class="inline-onebox" rel="noopener nofollow ugc">AttributeError: 'NoneType' object has no attribute '_free_weak_ref' after fusing layers · Issue #7339 · ultralytics/yolov5 · GitHub</a><br>
do you have any solution for this?</p>

ptrblck: <aside class="quote no-group" data-username="Nasr" data-post="16" data-topic="141940">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nasr/48/45997_2.png" class="avatar"> Nasr:</div>
<blockquote>
<p>i can’t understand with the pip wheels<br>
do you mean <a href="https://pypi.org/project/pytorch-wheel-installer/">pytorch-wheel-installer · PyPI</a> ?</p>
</blockquote>
</aside>
<p>No, I was referring to the <code>pip install torch ...</code> command.</p>
<aside class="quote no-group" data-username="Nasr" data-post="16" data-topic="141940">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nasr/48/45997_2.png" class="avatar"> Nasr:</div>
<blockquote>
<p>i have another problem with training after use conda and fix problem</p>
</blockquote>
</aside>
<p>I assume you’ve solved your initial issue using the conda binaries? If so, great!</p>
<aside class="quote no-group quote-modified" data-username="Nasr" data-post="16" data-topic="141940">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nasr/48/45997_2.png" class="avatar"> Nasr:</div>
<blockquote>
<p>i got this error<br>
<a href="https://github.com/ultralytics/yolov5/issues/7339">AttributeError: ‘NoneType’ object has no attribute ‘_free_weak_ref’ after fusing layers · Issue #7339 · ultralytics/yolov5 · GitHub</a><br>
do you have any solution for this?</p>
</blockquote>
</aside>
<p>No, I don’t know what might be causing this issue in the Yolo repo.</p>

Nasr: <p>aha thanks<br>
so i uninstall the torch by using pip uninstall torch -y<br>
then install torch  by</p>
<pre><code class="lang-auto">pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
</code></pre>

ptrblck: <p>If you are still hitting the:</p>
<pre><code class="lang-python">NVIDIA GeForce RTX 3090 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.
</code></pre>
<p>error, then yes.<br>
If PyTorch itself works fine now with your new conda binary then I would just leave it s it is.</p>

SkalskiP: <p>Hi! I faced a similar problem, but could not use conda to solve it. I managed to set it up without conda. Here are steps:</p>
<ol>
<li>
<p>Update your CUDA Toolkit. All steps to do that are listed <a href="https://developer.nvidia.com/cuda-11-6-1-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=Ubuntu&amp;target_version=20.04&amp;target_type=deb_local" rel="noopener nofollow ugc">here</a>. You just need to select your architecture, distribution and its version then download and install. Before you do that it is usually a good idea to go to pytorch website and check what is the latest supported CUDA version. Sometimes you may overshoot and install a version that is too new so it is worth checking out.</p>
</li>
<li>
<p>Execute required <a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions" rel="noopener nofollow ugc">post-install actions</a>. In my case the only thing that I needed to do is add <code>export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}</code> to my <code>.bashrc</code> file.</p>
</li>
<li>
<p>Confirm that your CUDA is installed correctly. Run <code>nvcc --version</code>. Do not really on CUDA version that is displayed by <code>nvidia-smi</code>. Sometimes those two commands show different values and <code>nvcc --version</code> is what we care about.</p>
</li>
<li>
<p>Uninstall <code>torch</code> and <code>torchvision</code> from your Python environment - <code>pip uninstall torch torchvision</code>.</p>
</li>
<li>
<p>Once again go pytorch website and select a configuration that works for you. You will get pip install command that is ready to use. In my case it was <code> pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116</code></p>
</li>
<li>
<p>Test is <code>torch</code> installed correctly. Run <code>python3</code> in terminal, and than:</p>
</li>
</ol>
<pre><code class="lang-auto">&gt;&gt;&gt; import torch
&gt;&gt;&gt;  torch.version.cuda
'11.6'
&gt;&gt;&gt; torch.cuda.get_arch_list()
['sm_37', 'sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86']
</code></pre>
<p>Good luck!</p>