13

I have installed pytorch under virtualenv via:

pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1.post2-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision

But for some reason:

import torch
torch.cuda.device_count()
0
torch.cuda.is_available()
False

Looks like pytorch detected cuda 9 for some reason:

torch._C._cuda_getDriverVersion()
9010

My system:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:    16.04
Codename:   xenial


nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105


Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux


ls -l /usr/local/ | grep cuda
lrwxrwxrwx  1 root   root      21 Mar 24 02:05 cuda -> /usr/local/cuda-10.0/
drwxr-xr-x 17 root   root    4096 Mar 24 02:06 cuda-10.0
drwxr-xr-x 15 root   root    4096 Nov 29 23:03 cuda-9.0
drwxr-xr-x 15 root   root    4096 Jan 10  2018 cuda-9.1

nvidia-smi -q | grep "Product Name"
    Product Name                    : GeForce GTX TITAN X
    Product Name                    : GeForce GTX 1080 Ti
talonmies
  • 70,661
  • 34
  • 192
  • 269
mrgloom
  • 20,061
  • 36
  • 171
  • 301
  • See [Why \`torch.cuda.is\_available()\` returns False even after installing pytorch with cuda?](https://stackoverflow.com/questions/60987997/why-torch-cuda-is-available-returns-false-even-after-installing-pytorch-with/61034368#61034368). This particular error appears to be the result of an out-of-date driver. `torch._C._cuda_getDriverVersion()` indicates that the latest version of CUDA the driver supports is CUDA 9.1. – jodag May 03 '22 at 19:31

1 Answers1

1

If torch._C._cuda_getDriverVersion() gives driver values, please try torch._C._cuda_getDeviceCount() to understand more.

Rajesh Kontham
  • 321
  • 1
  • 5