Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tsitsvero/aaa2b782eeb06d91f44fffe6d062b56d to your computer and use it in GitHub Desktop.
Save tsitsvero/aaa2b782eeb06d91f44fffe6d062b56d to your computer and use it in GitHub Desktop.
How to install CUDA 10.1 on Ubuntu 18.04
A clean installation of Ubuntu 18.04.02 LTS was used.
This gist is an extension to the [official docs](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html),
adding missing parts and instructions.
# 2 pre-install actions
follow the pre-installation actions on:
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions
## step 2.3 - install gcc
install gcc: `$ sudo apt-get install build-essential`
## step 2.5 - choose installation method
we'll be using the distribution-specific packages (deb)
## step 2.6 - download NVIDIA CUDA Toolkit
choose `Linux > x86_64 > Ubuntu > 18.04 > deb (local)`
**verification**
the link in the official docs redirect to md5 hashes of CUDA 9.2 files
use this link instead: https://developer.download.nvidia.com/compute/cuda/10.1/Prod/docs/sidebar/md5sum.txt
# 3 package manager installation
follow the instructions in the next section
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation
you'll run into the following error:
```
$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
cuda : Depends: cuda-10-1 (>= 10.1.105) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
```
to fix this, update your NVIDIA drivers to nvidia-418
use the following tutorial and use the method using PPA repository to install Nvidia Beta drivers:
https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-18-04-bionic-beaver-linux
summary:
```
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update
$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.1/0000:02:00.0 ==
modalias : pci:v000010DEd00001004sv00001458sd00003604bc03sc00i00
vendor : NVIDIA Corporation
model : GK110 [GeForce GTX 780]
driver : nvidia-driver-410 - third-party free
driver : nvidia-driver-396 - third-party free
driver : nvidia-driver-415 - third-party free
driver : nvidia-driver-390 - distro non-free
driver : nvidia-340 - distro non-free
driver : nvidia-driver-418 - third-party free recommended
driver : xserver-xorg-video-nouveau - distro free builtin
```
nvidia-driver-418 is recommended, therefore execute:
```
$ sudo ubuntu-drivers autoinstall
```
after that `$ sudo apt-get install cuda` will work
# 7 post-installation actions
follow the post-installation steps:
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment