Following official instructions:

michael@Pascal:~/temp$ ll
total 1.8G
-rw-r--r-- 1 root 1.8G Feb  1  2017 cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb

michael@Pascal:~/temp$ sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
(Reading database ... 92745 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604-8-0-local-ga2 (8.0.61-1) over (8.0.61-1) ...
Setting up cuda-repo-ubuntu1604-8-0-local-ga2 (8.0.61-1) ...

michael@Pascal:~/temp$ sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:5 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:6 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Hit:8 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:9 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Fetched 204 kB in 0s (267 kB/s)
Reading package lists... Done

michael@Pascal:~/temp$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cuda

I tried manually copying the .deb file to /var/cuda-repo-8-0-local-ga2 but got the same error.

  • That 1.8GB .deb file I downloaded is sitting right there, why can't it see it? CUDA is not installed: sudo apt-get remove --purge nvidia-* shows "0 to remove" – MichaelSB Jan 13 '18 at 16:12
  • Nothing from Nvidia has been installed: nvcc -V The program 'nvcc' is currently not installed. You can install it by typing: sudo apt install nvidia-cuda-toolkit and nvidia-smi NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running. The step that actually installs CUDA is sudo apt-get install cuda, and that didn't go through, as you can see from my post. – MichaelSB Jan 13 '18 at 16:22
  • 1
    You did sudo dpkg -i and sudo apt install at the same time? – George Udosen Jan 13 '18 at 16:45
  • Yes. I followed instructions from here: developer.nvidia.com/cuda-80-ga2-download-archive. What you see in my post is exactly how I ran it. – MichaelSB Jan 13 '18 at 16:48
  • 1
    dpkg-query -s cuda dpkg-query: package 'cuda' is not installed and no information is available – MichaelSB Jan 13 '18 at 23:18

I ran into this problem trying to install CUDA 9.0 on Ubuntu 17.10, and I solved it by uncommenting the following line in my /etc/apt/sources.list.d/cuda-9-0-local.list

# deb file:///var/cuda-repo-9-0-local / # disabled on upgrade to artful


deb file:///var/cuda-repo-9-0-local /
| improve this answer | |

I ran into this on 16.04 when trying to install CUDA 9.0 after removing an earlier 9.1 install. Apt search revealed that while the cuda packages had been removed, many leftover config files remained. The solution was simply to wipe out these remnants before attempting the reinstall:

dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

After that the install sequence you showed worked (mostly) as expected. I also found I needed to explicitly specify the version in the install command - changing install cuda to install cuda=<version>.

| improve this answer | |

I also had this problem. I was trying to uninstall CUDA 9.2 to upgrade to 10.0 on 18.04, and something I did in the process really confused the package manager.

@user811188 's answer was helpful, but before I did the dpkg --purge bit, I looked at the output and there were several not NVIDIA or CUDA related items in the list, so I did the following:

dpkg -l | grep '^rc' | awk '{print $2}' | grep cuda | sudo xargs dpkg --purge dpkg -l | grep '^rc' | awk '{print $2}' | grep nvidia | sudo xargs dpkg --purge

But before I had any success, I manually removed anything with cuda in the name from /var/lib/dpkg/info/ and /var. Not like, my proudest moment, but after that I was able to follow the install instructions successfully.

| improve this answer | |

Unlike other cases shown here, mine was a fresh install, so no upgrades.

However, I had made an attempt to steer the installation and set the option --instdir=[own target] for dpkg to install the deb package into a custom directory, like a 'prefix'. This was a try and an expected fail. Nonetheless, it created an entry of some sort in dpkg -l | grep cuda whereby sudo apt install -y cuda threw the error in point.

I have purged the package with the same commands as other the other answers. In my case sudo dpkg --purge cuda-repo-ubuntu1604-10-2-local-10.2.89-440.33.01.

Some scary messages followed, but they boiled down to saying that dpkg did not delete directories that not were empty or were system directories (like \var). Nor should it have done. The risk is that it has done evil things unaware of me. Not my proudest moment either.

| 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.