Skip to content

Instantly share code, notes, and snippets.

@qin-yu
Last active April 6, 2020 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qin-yu/7cbef039c2cdd25256c2029b24df68c9 to your computer and use it in GitHub Desktop.
Save qin-yu/7cbef039c2cdd25256c2029b24df68c9 to your computer and use it in GitHub Desktop.
Install CUDA 10.1 on Ubuntu 18.04

How do I Install CUDA on Ubuntu 18.04?

(DON'T) Add apt repo and install CUDA Toolkit (BAD solution)

# 1. do:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo ubuntu-drivers autoinstall
# 2. reboot;
# 3. do:
sudo apt install nvidia-cuda-toolkit gcc-6
nvcc --version

However, this gives CUDA 9.1 which doesn't even have a corresponding CuDNN.

Download and install from official website

So you have to go to the official CUDA website and download e.g. a .deb file. Install CUDA 10.1:

sudo dpkg -i cuda-repo-ubuntu1804_10.1.105-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda

Now everything broke: apt cannot fix itself.

sudo apt --fix-broken install will not work, but:

sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken

then apt remove everything including the old and new CUDA. then reboot and reinstall CUDA 10.1

Problem: what if I want both 10.1 and 10.0?

Just get another network .deb file from official website and in the final step:

sudo apt-get install cuda-10-0

Reference:

@qin-yu
Copy link
Author

qin-yu commented Mar 16, 2020

To check GPU vendor and model, as well as recommended drivers:

ubuntu-drivers devices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment