# 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.
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
Just get another network .deb file from official website and in the final step:
sudo apt-get install cuda-10-0
To check GPU vendor and model, as well as recommended drivers: