I have the latest ubuntu 18 installed just an hour ago. I have the newest anaconda 3.7 installed maybe 20 minutes ago. Then I proceeded to use

conda install pytorch torchvision -c pytorch

but when I open use python3 it still gives me

alex@alex:~$ python3
Python 3.7.0 (default, Jun 28 2018, 13:15:42) 
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()

To be sure, I do have a gpu in my computer:

alex@alex:~$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)

I have also restarted my computer after the installing pytorch and it did not change anything. This is my second attempt at getting GPU to work on pytorch, my last attempt was on Lubuntu a few days ago using pip install and I installed some Nvidia drivers but still couldn't get it to work so i started anew.


Just found a solution, maybe.... Check https://ubuntuforums.org/showthread.php?t=2377560 for details.

Maybe you have a hybrid graphic card and this can cause a wrong installation of driver. Please also check that secure boot is disabled in bios.

Run in terminal:

sudo apt purge nvidia*
sudo apt update
sudo ubuntu-drivers autoinstall
sudo apt full-upgrade

Reboot and check again.

| improve this answer | |

As I can see you have done "normal" installation of PyTorch, which is at the moment CUDA 9.

I just checked the NVIDIA CUDA 9 Documentation , Ubuntu 18 is not supported in this case. If you want to use CUDA on Ubuntu 18, then you have to use CUDA 10 according to documentation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.