Can not install CUDA enabled PyTorch

hongxiang_li: <p>Hi,</p>
<p>I was trying to run a GPU based code. I followed the PyTorch official website to install PyTorch using ” conda install pytorch torchvision pytorch-cuda=11.6 -c pytorch -c nvidia”</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/5/45ee147449b852a1a6b056d6cc18cff61438050f.png" data-download-href="https://discuss.pytorch.org/uploads/default/45ee147449b852a1a6b056d6cc18cff61438050f" title="Screen Shot 2022-11-19 at 11.04.45"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/5/45ee147449b852a1a6b056d6cc18cff61438050f_2_690x271.png" alt="Screen Shot 2022-11-19 at 11.04.45" data-base62-sha1="9YD1OBlab7JDvUK75vW3xtrFRrF" width="690" height="271" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/5/45ee147449b852a1a6b056d6cc18cff61438050f_2_690x271.png, https://discuss.pytorch.org/uploads/default/original/3X/4/5/45ee147449b852a1a6b056d6cc18cff61438050f.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/4/5/45ee147449b852a1a6b056d6cc18cff61438050f.png 2x" data-dominant-color="F7D2CE"><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">Screen Shot 2022-11-19 at 11.04.45</span><span class="informations">826×325 27.6 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>
<p>However, when I try to run the code, this error occur:</p>
<p>“AssertionError: Torch not compiled with CUDA enabled”</p>
<p>Also, when I use “conda list” to see all the packages, I find out the pytorch is based on CPU.</p>
<p>“pytorch                   1.10.2          cpu_py38h6f0ae12_0<br>
pytorch-cuda              11.6                 h867d48c_0    pytorch”</p>
<p>I wonder if there is any way to install cuda enabled pytorch.</p>
<p>Thanks for your time in advance!</p>

ptrblck: <aside class="quote no-group" data-username="hongxiang_li" data-post="1" data-topic="166407">
<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/hongxiang_li/48/55011_2.png" class="avatar"> hongxiang_li:</div>
<blockquote>
<p>Also, when I use “conda list” to see all the packages, I find out the pytorch is based on CPU.</p>
<p>“pytorch 1.10.2 cpu_py38h6f0ae12_0<br>
pytorch-cuda 11.6 h867d48c_0 pytorch”</p>
</blockquote>
</aside>
<p>Not only is a CPU-only binary installed but also an older one (<code>1.10.2</code> while the current stable release is <code>1.13.0</code> as shown in your screenshot).<br>
Uninstall all older PyTorch binaries and builds, and reinstall the new desired one. Creating a new and clean virtual conda environment might also help.</p>

NicoHambauer: <p>Hi there,<br>
I was also used to <a href="https://pytorch.org/get-started/locally/" class="inline-onebox" rel="noopener nofollow ugc">Start Locally | PyTorch</a> showing this command for linux and conda:</p>
<p><code>conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c nvidia</code></p>
<p>Now, since Nov or Dec 2022 it shows:</p>
<p><code>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia</code></p>
<p>This seems to be some kind of metapackage which does not work out for me (<a href="https://anaconda.org/pytorch/pytorch-cuda" class="inline-onebox" rel="noopener nofollow ugc">Pytorch Cuda :: Anaconda.org</a>)</p>
<p>In contrast to the first command the second one ends up in a never ending:</p>
<pre><code class="lang-auto">...
Solving environment: /
</code></pre>
<p>The first command seems to continue to work for me.<br>
Best,<br>
Nico</p>