Torch.cuda.is_available() returns False with CUDA 10.2 Python3.8 Pytorch1.5 and1.6 ubuntu 16.04

username: lostork
cooked: <p>I try to install pytorch on my server but it cannot find GPU. torch.cuda.is_available() always returns False. I have checked all that I can check(driver version, GPU compatibility, GCC version, kernel version).It still does not work.</p>
<p>First, I install pytorch by <strong>pip install torch torchvision</strong>. collect_env.py result:</p>
<pre><code class="lang-auto">pip 10.2 1.6

Collecting environment information...
PyTorch version: 1.6.0
Is debug build: No
CUDA used to build PyTorch: 10.2

OS: Ubuntu 16.04.4 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
CMake version: version 3.5.1

Python version: 3.8
Is CUDA available: No
CUDA runtime version: 10.2.89
GPU models and configuration:
GPU 0: Tesla P40
GPU 1: Tesla P40
GPU 2: Tesla P40
GPU 3: Tesla K80
GPU 4: Tesla K80

Nvidia driver version: 440.33.01
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.19.1
[pip3] torch==1.6.0
[pip3] torchvision==0.7.0
[conda] numpy                     1.19.1                   pypi_0    pypi
[conda] torch                     1.6.0                    pypi_0    pypi
[conda] torchvision               0.7.0                    pypi_0    pypi
</code></pre>
<p>I uninstall pytorch and reinstall it by <strong>conda install pytorch torchvision cudatoolkit=10.2 -c pytorch</strong>,collect_env.py result:</p>
<pre><code class="lang-auto">Collecting environment information...
PyTorch version: 1.6.0
Is debug build: No
CUDA used to build PyTorch: 10.2

OS: Ubuntu 16.04.4 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
CMake version: version 3.5.1

Python version: 3.8
Is CUDA available: No
CUDA runtime version: 10.2.89
GPU models and configuration:
GPU 0: Tesla P40
GPU 1: Tesla P40
GPU 2: Tesla P40
GPU 3: Tesla K80
GPU 4: Tesla K80

Nvidia driver version: 440.33.01
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.19.1
[pip3] torch==1.6.0
[pip3] torchvision==0.7.0
[conda] blas                      1.0                         mkl    defaults
[conda] cudatoolkit               10.2.89              hfd86e86_1    defaults
[conda] mkl                       2020.1                      217    defaults
[conda] mkl-service               2.3.0            py38he904b0f_0    defaults
[conda] mkl_fft                   1.1.0            py38h23d657b_0    defaults
[conda] mkl_random                1.1.1            py38h0573a6f_0    defaults
[conda] numpy                     1.19.1           py38hbc911f0_0    defaults
[conda] numpy-base                1.19.1           py38hfa32c7d_0    defaults
[conda] pytorch                   1.6.0           py3.8_cuda10.2.89_cudnn7.6.5_0    pytorch
[conda] torchvision               0.7.0                py38_cu102    pytorch
</code></pre>
<p>torch.cuda.is_available() always returns False… I need your help.</p>
<p>results of <strong>nvcc --version</strong></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>

username: mathematics
cooked: <p>I think There is no cuda installed.</p>
<pre><code class="lang-auto">Is CUDA available: No

</code></pre>
<p>You might have to download cuda (10.2) from nvidia.</p>

username: Flock1
cooked: <p>Hi.</p>
<p>I installed CUDA on my machine but I am using an anaconda environment to work with PyTorch. So in the environment, when I install PyTorch, cudatoolkit is also installed. But when I run it in python, it’s not recognizing the GPU. What should I do then?</p>
<p>NVIDIA driver: 450.57<br>
Python: 3.8<br>
pytorch: 1.5<br>
torchvision: 0.6<br>
cudatoolkit: 10.1.243</p>
<p>What should I do?</p>

username: lostork
cooked: <p>I have installed cuda. results of <strong>nvcc --version</strong>:</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>

username: mathematics
cooked: <p>as</p>
<blockquote>
<p>pytorch: 1.5<br>
torchvision: 0.6<br>
cudatoolkit: 10.1.243</p>
</blockquote>
<p>You have installed 10.1 version which may be not compatible with 10.2 release .  ,</p>
<pre><code class="lang-auto"># CUDA 9.2
conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=9.2 -c pytorch

# CUDA 10.1
conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.1 -c pytorch

# CUDA 10.2
conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch

# CPU Only
conda install pytorch==1.5.0 torchvision==0.6.0 cpuonly -c pytorch
</code></pre>
<p>source : <a href="https://pytorch.org/get-started/previous-versions/" rel="noopener nofollow ugc">https://pytorch.org/get-started/previous-versions/</a></p>
<p><strong>While installing be sure remove previous pytorch and cudatoolkits and make new conda enviroment to avoid conflicts.</strong></p>

username: mathematics
cooked: <p>I think you should remove and reinstall pytorch in new conda enviroment. Also restarting might work sometimes.</p>

username: RaLo4
cooked: <p>my collect_env.py results are pretty much the same as yours.</p>
<pre><code class="lang-auto">$ python collect_env.py 
Collecting environment information...
PyTorch version: 1.6.0
Is debug build: No
CUDA used to build PyTorch: 10.2

OS: Ubuntu 18.04.3 LTS
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CMake version: version 3.10.2

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 10.2.89
GPU models and configuration: GPU 0: GeForce RTX 2060
Nvidia driver version: 440.33.01
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.4

Versions of relevant libraries:
[pip3] numpy==1.16.2
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               10.2.89              hfd86e86_1  
[conda] efficientnet-pytorch      0.6.3                    pypi_0    pypi
[conda] mkl                       2019.4                      243  
[conda] mkl-service               2.3.0            py37he904b0f_0  
[conda] mkl_fft                   1.0.15           py37ha843d7b_0  
[conda] mkl_random                1.1.0            py37hd6b4f25_0  
[conda] numpy                     1.17.4           py37hc1035e2_0  
[conda] numpy-base                1.17.4           py37hde5b4d6_0  
[conda] numpydoc                  0.9.2                      py_0  
[conda] pytorch                   1.6.0           py3.7_cuda10.2.89_cudnn7.6.5_0    pytorch
[conda] torchvision               0.7.0                py37_cu102    pytorch
</code></pre>
<p>But as you can see I do not have this</p>
<aside class="quote no-group" data-username="lostork" data-post="1" data-topic="91689">
<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/l/85f322/48.png" class="avatar"> lostork:</div>
<blockquote>
<pre><code class="lang-auto">[pip3] torch==1.6.0
[pip3] torchvision==0.7.0
</code></pre>
</blockquote>
</aside>
<p>You should maybe try and properly uninstall the pytorch you installed via pip3</p>

username: Flock1
cooked: <p>Yup. Rebooting helped!!! Thanks</p>