Issues Installing Pytorch with CUDA Enabled

username: John_Palmer
cooked: <p>I have had to do a complete Anaconda re-installation this morning. Previous to this I had a working PyTorch installation which allowed for training using my GPU.</p>
<p>Now after re-installation of conda I can’t get Pytorch to see that CUDA is installed and therefore torch it is being compiled without CUDA enabled. The specific error that is thrown is:</p>
<pre><code class="lang-auto">raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
</code></pre>
<p>I’m using Linux Mint 20.2 and the output of running NVidia-smi shows the following driver and CUDA versions:</p>
<pre><code class="lang-auto">NVIDIA-SMI 470.103.01   Driver Version: 470.103.01   CUDA Version: 11.4
</code></pre>
<p>Finally to install Pytorch I issued the following command:</p>
<pre><code class="lang-auto">conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
</code></pre>
<p>If I run following commands from within the conda environment:</p>
<pre><code class="lang-auto">print('__CUDA VERSION:', torch.version.cuda)
print('__CUDNN VERSION:', torch.backends.cudnn.version())
</code></pre>
<p>I get the following outputs:</p>
<pre><code class="lang-auto">__CUDA VERSION: None
__CUDNN VERSION: None
</code></pre>
<p>So my understanding from reading other posts on this matter indicate that the system CUDA installation won’t be used and that instead CUDA 10.2 and 11.3 are packaged with Pytorch. My Nvidia driver version is &gt;= 450.80.02 which is required for Cuda 11.x.</p>
<p>Any idea what I can do to get Pytorch to compile with CUDA enabled?</p>
<p>Edit: So after looking in a bit more detail, it would appear that Conda is installing a pytorch cpu build (note this was attempting to install with CUDA 10.2:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/b/fb9be136ad4e95bca5c53649d7a91a49098eede0.png" data-download-href="https://discuss.pytorch.org/uploads/default/fb9be136ad4e95bca5c53649d7a91a49098eede0" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/f/b/fb9be136ad4e95bca5c53649d7a91a49098eede0_2_432x500.png" alt="image" data-base62-sha1="zTPOAgCrtUWaZgtIZUnV92SAiAw" width="432" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/f/b/fb9be136ad4e95bca5c53649d7a91a49098eede0_2_432x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/f/b/fb9be136ad4e95bca5c53649d7a91a49098eede0_2_648x750.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/f/b/fb9be136ad4e95bca5c53649d7a91a49098eede0_2_864x1000.png 2x" data-dominant-color="060606"><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">994×1150 102 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>Cheers<br>
John</p>

username: John_Palmer
cooked: <p>Turns out this was actually a Conda issue, where it was installing the cpu build for some reason. Installation using the pip command appears to have fixed the issue.</p>