Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install CUDA 9.2, cuDNN 7.2.1, Anaconda and PyTorch on Ubuntu 16.04.
# tested on AWS p2.xlarge August 29, 2018
# install CUDA
sudo apt-get update && sudo apt-get install wget -y --no-install-recommends
wget -c ${CUDA_URL} -O cuda.deb
sudo dpkg --install cuda.deb
sudo apt-key add /var/cuda-repo-9-2-local/
sudo apt-get update
sudo apt-get install -y cuda
rm cuda.deb
wget -c ${CUDA_PATCH_URL} -O cuda_patch.deb
sudo dpkg --install cuda_patch.deb
sudo apt-get upgrade -y cuda
rm cuda_patch.deb
# install cuDNN 7.2.1
wget -c ${CUDNN_URL} -O cudnn.tgz
sudo tar -xzf cudnn.tgz -C /usr/local
rm cudnn.tgz
sudo ldconfig
# add variables to .profile
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.profile
echo 'export PATH=${CUDA_HOME}/bin:${PATH}' >> ~/.profile
echo 'export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH' >> ~/.profile
# install conda
wget -c "" -O
bash -b
echo 'export PATH=/home/ubuntu/anaconda3/bin:${PATH}' >> ~/.profile
# setup environment variables
source ~/.profile
# install pytorch
conda install -y pytorch torchvision cuda92 -c pytorch
Copy link

mrgloom commented Nov 29, 2018

But how to know which cudnn version is compatible with particular cuda version?

Copy link

Sultan91 commented Dec 1, 2018

Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from

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