How-To | Install Theano with Cuda-Support in Anaconda (Arch-Linux)

Install Anaconda

1
pacman -S anaconda

Ignore Anaconda-Upgrades (otherwise it will overwrite all changes)

1
2
pacman -Syu --ignore anaconda
yaourt -Syu --aur --ignore anaconda

Create new Python 3.5 Environment

1
sudo conda create -n py35 python=3.5 anaconda

Change permissions of anaconda (so that you can install without root)

1
sudo chown -R [User] /opt/anaconda

Install Theano

1
2
source activate py35
conda install theano

Install CUDA (Make sure /tmp is large enough)

1
yaourt -Syu --aur cuda-8.0

Install cuDnn

  • Download
    cuDnn 5.1 for Cuda 8.0

  • Install

    1
    2
    3
    tar -xvzf cudnn-8.0-linux-x64-v5.1.tgz
    mv ./cuda/include/* /opt/cuda/include
    mv ./cuda/lib64/* /opt/cuda/lib64

Create .theanorc (in ~/.theanorc)

1
2
3
4
5
6
7
[global]
device=cuda
floatX=float32
cuda.root=/opt/cuda
## Set explicitly compiler in case gcc >= 6 is system default
gcc.cxxflags=-Wnarrowing
cxx=/usr/bin/g++-5

Install Jupyter Extensions

1
2
3
4
conda install -c conda-forge jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
/opt/anaconda/bin/jupyter notebook