Cuda.is_available() throws False

iceman: <p>I am using PyTorch on XPS 15 with GTX1050Ti and CUDA 10.1</p>
<p>I installed pytorch using the command:<br>
<code>conda install pytorch torchvision cudatoolkit=10.1 -c pytorch</code></p>
<p>However, <code>cuda.is_available()</code> throws <code>False</code>. I dug into the issue and figured out that pytorch can indeed find the right cuda library <code>cudart64_101</code> but I also get the followng assertion error:<br>
AssertionError(“Torch not compiled with CUDA enabled”)</p>
<p>This seems inconsistent. Can someone help me get this to work?</p>
<p>Also see:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/d/7d437480f68de5ab3a4671b73590e0a15a7755aa.png" data-download-href="https://discuss.pytorch.org/uploads/default/7d437480f68de5ab3a4671b73590e0a15a7755aa" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/d/7d437480f68de5ab3a4671b73590e0a15a7755aa_2_513x500.png" alt="image" data-base62-sha1="hS8cKClh5nQHmQNFLYzbo7bYWCu" width="513" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/d/7d437480f68de5ab3a4671b73590e0a15a7755aa_2_513x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/d/7d437480f68de5ab3a4671b73590e0a15a7755aa_2_769x750.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/7/d/7d437480f68de5ab3a4671b73590e0a15a7755aa_2_1026x1000.png 2x" data-dominant-color="151515"><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">1986×1934 319 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>

ptrblck: <p>Your local CUDA installation won’t be used, if you install the binaries, as they ship with their own CUDA, cudnn etc.</p>
<p>Did you see, which PyTorch binary (with which CUDA version) was installed?<br>
Also, which driver version are you using locally?</p>

iceman: <p>As I mentioned, I used this command:<br>
<code>conda install pytorch torchvision cudatoolkit=10.1 -c pytorch</code><br>
to install pytorch</p>
<p>EDIT: I removed the local installation of cuda. I removed pytorch, torchvision and cudatoolkit. Then I did a clean install of pytorch using the above command and still the cuda is avaliable throws false. Any suggestions would be helpful</p>

ptrblck: <p>Sure, but which output did <code>conda</code> give after running the command?</p>
<aside class="quote no-group" data-username="ptrblck" data-post="2" data-topic="61251">
<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/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p>Also, which driver version are you using locally?</p>
</blockquote>
</aside>

iceman: <p>Here’s what I get:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/e/6eca2bf531ac864e330eb27851bac366e05c5936.png" data-download-href="https://discuss.pytorch.org/uploads/default/6eca2bf531ac864e330eb27851bac366e05c5936" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eca2bf531ac864e330eb27851bac366e05c5936_2_575x500.png" alt="image" data-base62-sha1="fO5FHD6aSbutNqn139gmxNrNiaW" width="575" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eca2bf531ac864e330eb27851bac366e05c5936_2_575x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eca2bf531ac864e330eb27851bac366e05c5936_2_862x750.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/6/e/6eca2bf531ac864e330eb27851bac366e05c5936_2_1150x1000.png 2x" data-dominant-color="111111"><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">1648×1432 145 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>EDIT: That right there is the problem!<br>
I need:</p>
<pre><code class="lang-auto">pytorch-1.3.1-py3.7_cuda101_cudnn7_0 
torchvision-0.4.2-py37_cu101 
cudatoolkit=10.1
</code></pre>
<p>but when I run:</p>
<pre><code class="lang-auto">conda install pytorch-1.3.1-py3.7_cuda101_cudnn7_0 torchvision-0.4.2-py37_cu101 cudatoolkit=10.1 -c pytorch
</code></pre>
<p>it doesn’t work</p>
<p>EDIT2:<br>
I manually downloaded the correct versions and used the following command:</p>
<pre><code class="lang-auto">conda install pytorch-1.3.1-py3.7_cuda101_cudnn7_0.tar.bz2 torchvision-0.4.2-py37_cu101.tar.bz2 cudatoolkit-10.1.168-0.tar.bz2 ninja-1.9.0-py37h74a9793_0.tar.bz2
</code></pre>
<p>and now it works. I think the command on the pytorch website might be broken. How do I report this?</p>

Jeff_Winchell: <p>OS: Windows<br>
PyTorch version: 1.4   print(torch.<strong>version</strong>)<br>
How you installed PyTorch (conda, pip, source): conda install pytorch torchvision cudatoolkit=10.1 -c pytorch<br>
Python version: 3.7.1 (installed previously)<br>
CUDA/cuDNN version: 10.1/7.6 (installed previously using NVidia instructions)<br>
GPU models and configuration: NVIDIA Geforce GTX 1050</p>
<p>import torch<br>
print(torch.cuda.is_available())</p>
<p>FALSE</p>
<p>print(torch.backends.cudnn.version())<br>
7605</p>
<p>(Cudnn installed previously using NVidia instructions)</p>
<p>nvcc --version<br>
Cuda compilation tools, release 10.1, V10.1.105</p>
<p>NVIDIA-SMI<br>
Driver Version 445.75    (installed previously using NVidia instructions)</p>

peterjc123: <p>Then you are probably using the cpu version of PyTorch. Please uninstall <code>cpuonly</code> and <code>PyTorch</code>, and try again.</p>

Jeff_Winchell: <p>I did that. I went further and uninstalled all python, conda and everything else I couldn’t live without on my computer. Then I installed miniconda and pytorch. per pytorch install instructions, conda did not install the VC runtime, but once I got that on, I was finally able to get a true value from torch.cuda.is_available().</p>
<p>(See <a href="https://github.com/pytorch/pytorch/issues/32916#issuecomment-611857832" rel="nofollow noopener">https://github.com/pytorch/pytorch/issues/32916#issuecomment-611857832</a>)</p>