pytorch/pytorch

torch.cuda.is_available() is false after CUDA 9.0.176 installed. Could anyone help me with this? Thanks!

Dee-Ma opened this issue · 12 comments

🐛 Bug

Hi,

I just got a very strange problem:

I used the commands: "print(torch.version)
print(torch.version.cuda)
print(torch.backends.cudnn.version())", the output were:

0.4.1.post2 (PyTorch version)
9.0.176 (CUDA version)
7.1.2 (cuDNN version)

I also used the "nvcc --version", the results were:

capture4

It was very strange, it seems that the CUDA version installed in Linux system is 9.0.176, and the CUDA that the PyTorch needed is also 9.0.176, but, the "cuda.is_available()" still returns "False".

Could anyone help me with this? Many thanks!

Environment

  • PyTorch Version (e.g., 1.0): 0.4.1.post2
  • OS (e.g., Linux): Linux
  • Python version: 3.6.5 : : Anaconda, Inc.
  • CUDA/cuDNN version: 9.0.176 (CUDA version); 7.1.2 (cuDNN version)

I met the same problem with you. Now, I find the solution.
Environment :
OS (e.g., Linux): Linux
Python version: Python 3.6.7 : : Anaconda, Inc.

as the steps descripted by https://pytorch.org/

PyTorch Build : Preview(Nightly)
Your OS: Linux
Package: Pip
Language: Python3.6
CUDA: 8.0 (maybe 9.0 is also OK, you can select your own version)
then, the command will appear:

pip install numpy torchvision_nightly
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu80/torch_nightly.html

After running above commands successfully,

>>> import torch
>>> torch.cuda.is_available()
True

I met the same problem with you. Now, I find the solution.
Environment :
OS (e.g., Linux): Linux
Python version: Python 3.6.7 : : Anaconda, Inc.

as the steps descripted by https://pytorch.org/

PyTorch Build : Preview(Nightly)
Your OS: Linux
Package: Pip
Language: Python3.6
CUDA: 8.0 (maybe 9.0 is also OK, you can select your own version)
then, the command will appear:

pip install numpy torchvision_nightly
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu80/torch_nightly.html

After running above commands successfully,

>>> import torch
>>> torch.cuda.is_available()
True

This works for me. Thank you.

I am using cuda 9.0, so I changed cu80 to cu90
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu90/torch_nightly.html
and it worked. Thank you.

I am using cuda 9.0, so I changed cu80 to cu90
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu90/torch_nightly.html
and it worked. Thank you.

thanks you very much !!!

my torch version is 1.3.0, torchvision version is 0.4.1, when i use "print(torch.version.cuda)
print(torch.backends.cudnn.version()",the output are 10.1.243 and 7603 separately,I use this command “cat /usr/local/cuda/version.txt ”to see my cuda version,the output is 9.0.176.
I fellowed yagamimisa‘s steps and changed cu80 to cu90,but it didn't work for me.
anyone meet this problem?

@Zhizh1 those steps are outdated. we provide cuda 9.2 and 10.1 binaries as of today. If you upgrade your nvidia driver on your system, you should be good

I have two machines, one is 1080ti, the other is tesla v100 pcie, the environment is the same: driver version 430.40, cuda 10.1, pytorch 1.3, torchvision 0.4.1. Both nvidia-smi works fine. torch.cuda.is_available() returns false on v100, but true on 1080ti.
any advice on this problem?

@wuwuwuxxx V100 needs atleast CUDA 10

cuda 10.1 already, installed through conda cudatoolkit, should I install cuda 10 lib in a nvidia way?

This is what I got

>>> torch.version.cuda
'10.1.243'
>>> torch.cuda.is_available()
False
~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

I also played around DeepIn, in which some of the message show:

Preparing to unpack .../00-ocl-icd-libopencl1_2.2.11-1ubuntu1_i386.deb ...
Unpacking ocl-icd-libopencl1:i386 (2.2.11-1ubuntu1) ...
Selecting previously unselected package linux-libc-dev:i386.
Preparing to unpack .../01-linux-libc-dev_4.15.0-76.86_i386.deb ...
Unpacking linux-libc-dev:i386 (4.15.0-76.86) ...
Selecting previously unselected package libc6-dev:i386.
Preparing to unpack .../02-libc6-dev_2.27-3ubuntu1_i386.deb ...
Unpacking libc6-dev:i386 (2.27-3ubuntu1) ...
Selecting previously unselected package binfmt-support.
Preparing to unpack .../03-binfmt-support_2.1.8-2_amd64.deb ...
Unpacking binfmt-support (2.1.8-2) ...
Selecting previously unselected package libice6:i386.
Preparing to unpack .../04-libice6_2%3a1.0.9-2_i386.deb ...
Unpacking libice6:i386 (2:1.0.9-2) ...
Selecting previously unselected package libsm6:i386.
Preparing to unpack .../05-libsm6_2%3a1.2.2-1_i386.deb ...
Unpacking libsm6:i386 (2:1.2.2-1) ...
Selecting previously unselected package libxt6:i386.
Preparing to unpack .../06-libxt6_1%3a1.1.5-1_i386.deb ...
Unpacking libxt6:i386 (1:1.1.5-1) ...
Selecting previously unselected package libatk1.0-0:i386.
Preparing to unpack .../07-libatk1.0-0_2.28.1-1_i386.deb ...
Unpacking libatk1.0-0:i386 (2.28.1-1) ...
Selecting previously unselected package libgdk-pixbuf2.0-0:i386.
Preparing to unpack .../08-libgdk-pixbuf2.0-0_2.36.11-2_i386.deb ...

is it the problem that these selection arise from new operations affect cuda ? (like, changing the reference)

Make Sure your NVIDIA Driver is latest,
My system specs:
Ubuntu 18.04 64bit
Langauge: python3

I also got same issue after torch installation, But after a bit searching, I installed latest NVIDIA drivers,Check here.

After that, It returned True.