Installing CUDA is becoming increasingly easier on Ubuntu. I think I keep hitting problems because I am usually updating from an older NVIDIA graphics driver or CUDA version. NVIDIA continues to be quite bad at providing error-free upgrades. Anyway, this is what worked for me:
Do not try to install any of the NVIDIA drivers or CUDA packages that are in the Ubuntu repositories. I wasted a day with the errors these operations threw up!
Uninstall all CUDA packages and NVIDIA drivers you may have on your Ubuntu system.
Download the CUDA
.deb package for Ubuntu 14.04 from here. For me, it was a
.deb file just adds a CUDA repository maintained by NVIDIA. Install this
.deb file and update:
$ sudo gdebi cuda-repo-ubuntu1404_6.5-14_amd64.deb $ sudo apt-get update
$ sudo apt-get install cuda
This is a big install, it will install everything including a
nvidia-340 driver that actually worked and NVIDIA NSight. After the install, reboot the computer. Your CUDA is ready for work now 😊
Note: I tried this on two systems. On one, it installed without any problem. On the other, it gave an error of unmet dependencies. I have described here how I solved this problem.
Tried with: NVIDIA GeForce GTS 250 and NVIDIA GTX Titan