I tried to install CUDA on Ubuntu but got errors.

I follow official guide for installation. And actually I succeed on my own mac. But on ubuntu 18.04 machine, when I tried to test those samples, it showed that no CUDA-capable device detected, but actually there is an nvidia GPU, GTX470. Also, "nvidia-smi" command doesn't work, saying can't find the CUDA driver, but actually, if we run apt-get install cuda driver, it showed that cuda driver is already installed. You may check the error image:

Error message

  • 1
    Don't use the Wayland login option, it switches the display to the integrated graphics. Even running Wayland, the non-graphics CUDA samples should still run. – ubfan1 Dec 6 '18 at 21:09
  • I agree with @ubfan1 above and make sure you are logging in using the XOrg option. Your graphics card is listed at using the 396.18 driver. If you follow the answer askubuntu.com/a/1086993/231142 but download CUDA 10 from here you should be able to step through and set it up correctly. I can try to write an answer later if that helps. – Terrance Dec 6 '18 at 21:45

Use the installation guide provided here by eromod. This worked for me on 18.04 on different computers, other than the official version.

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt update

sudo ubuntu-drivers autoinstall


sudo apt install nvidia-cuda-toolkit gcc-6

nvcc --version
| improve this answer | |
  • You are welcome, please mark the answer as "accepted" then. :) @JadenPan – Turtle10000 Dec 12 '18 at 8:23

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.