Archives / Snippets / Projets

(see: https://www.codingforentrepreneurs.com/blog/install-tensorflow-gpu-windows-cuda-cudnn/)

  • You will have to download a 2Gb file
  • Nvidia Dev Network (for cuDNN) !!!
  1. First, check that your Nvidia card is installed.
# Ubuntu
nvidia-smi
  1. Install tensorflow-gpu
pip install tensorflow-gpu --upgrade
  1. Try to run and fail (at this stage, it's "normal") :
python -c 'import tensorflow'
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
  1. Go to Nvidia Archive https://developer.nvidia.com/cuda-toolkit-archive and choose the correct version !
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub 
sudo apt-get update
sudo apt-get install cuda-toolkit-9-0
  1. Install tensorflow-gpu
pip install tensorflow-gpu --upgrade
  1. Try to run and fail (...) :
python -c 'import tensorflow'
  1. Install cuDNN : fuck you nvidia! Just follow the steps... grrrr

  2. Reinstall updated driver...
sudo apt purge nvidia-*

Removes:

libcuda1-378* nvidia-378* nvidia-381* nvidia-opencl-icd-378* nvidia-opencl-icd-381* nvidia-prime* nvidia-settings*

Then:

sudo apt install nvidia-opencl-icd-390 

Installs:

libcuda1-390 nvidia-390 nvidia-opencl-icd-390 nvidia-prime nvidia-settings xserver-xorg-legacy
  1. REBOOT

  2. Install tensorflow-gpu
pip uninstall tensorflow
pip install tensorflow-gpu