Installing TensorFlow for Python on Arch Linux (with CUDA 9 and CUDNN 7)

  1. Installing CUDA 9 requires installation of gcc6. (This first step may take couple of hours.)
    yaourt -S gcc6
  2. Remove any existing installations of CUDA
    sudo pacman -R cuda
    pacaur -S chromedriver
  3. Download CUDA 9 package from Arch Linux archives
  4. Install CUDA 9 from local package (Requires Step 1 to be complete)
    sudo pacman -U cuda-9.0.176-4-x86_64.pkg.tar.xz
  5. Prevent CUDA from upgrading to version 10.
    sudo vim /etc/pacman.conf
    Uncomment the IgnorePKG line to add cuda to make the line
    IgnorePKg = cuda
  6. Download and install CUDNN 7.0.4-2
    sudo pacman -U cudnn-7.1.4-1-x86_64.pkg.tar.xz
  7. Install TensorFlow in your virtual environment
    pip install tensorflow-gpu
  8. Rejoice!