Torch not getting GPU

username: Miguel_Castillo
cooked: <p>Hello, Im trying to use pytorch with GPU in my ubuntu 18.04. The GPU is a GeForce GTX 1070</p>
<p>nvidia-smi:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/7/c7c3572484c54a6458c947c6aa8492215b3d49ab.png" data-download-href="https://discuss.pytorch.org/uploads/default/c7c3572484c54a6458c947c6aa8492215b3d49ab" title="nvidia-smi-herc"><img src="https://discuss.pytorch.org/uploads/default/original/3X/c/7/c7c3572484c54a6458c947c6aa8492215b3d49ab.png" alt="nvidia-smi-herc" data-base62-sha1="svbwX4Vl4YBFXsrulvuTBcSeIwb" width="690" height="477" data-dominant-color="393939"><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">nvidia-smi-herc</span><span class="informations">729×504 56.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>nvcc --version:</p>
<pre><code class="lang-auto">nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
</code></pre>
<p>.bashrc file:</p>
<pre><code class="lang-auto">export PATH="/usr/local/cuda-10.2/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH"
</code></pre>
<p>I installed pytorch using:</p>
<pre><code class="lang-auto">pip install torch torchvision torchaudio
</code></pre>
<p>from <a href="https://pytorch.org/" rel="noopener nofollow ugc">here</a></p>
<p>Torch version:</p>
<pre><code class="lang-auto">PyTorch Version: 1.8.0
</code></pre>
<p>Python version:</p>
<pre><code class="lang-auto">Python 3.8.7
</code></pre>
<p>gcc/g++ versions:</p>
<pre><code class="lang-auto">gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
</code></pre>
<p>If I try to get the GPU, I get the following:</p>
<pre><code class="lang-auto">&gt;&gt;&gt; import torch
&gt;&gt;&gt; print(torch.cuda.is_available())
False
</code></pre>
<p>Can anyone advice me please</p>

username: ptrblck
cooked: <p>Did the logs show that the CUDA runtime was also installed?<br>
If so, what does <code>torch.version.cuda</code> return?<br>
Note that the binaries ship with their own CUDA runtime (as well as cudnn, NCCL etc.), so your local CUDA toolkit won’t be used unless you build PyTorch from source or any custom CUDA extension.</p>

username: Kapil_Rana
cooked: <p>I would say use anaconda enovirement and install torch using conda .<br>
Look out for command like<br>
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch</p>
<p>you can see the command in <a href="https://pytorch.org/" rel="noopener nofollow ugc">https://pytorch.org/</a></p>
<p>conda command will install all CUDA libraries required.</p>
<p>Now if you still don’t want to use anaconda then you have to check for PyTorch version compatibility with installed system CUDA.<br>
I can see your command is compatible with CUDA 10.2<br>
but you have CUDA 11.2 installed.<br>
i don’t know compatible PyTorch version of CUDA 11.2</p>
<p>I would suggest use anaconda, it will save lot of time.</p>

username: Miguel_Castillo
cooked: <p>Hey, thanks for your reply. Using conda solved my problems!!</p>

username: Miguel_Castillo
cooked: <p>Thanks for your reply. Problem solved</p>