Setup Ubuntu 14.04 with Cuda and Lasagne

Apr 5, 2016

Installation of prerequisites

    # Install common stuff
    sudo apt-get install build-essential
    sudo apt-get install zsh git

    # Install SciPy dependencies
    sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran

    # Install pyenv
    curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

    # Install python 3.5.0
    env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.5.0

    # Install cuda
    wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
    sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
    sudo apt-get update
    sudo apt-get install cuda
    popd

    # Create theanorc
    echo "[global]" > ~/.theanorc
    echo "floatX = float32"
    echo "device = gpu"

Create pyenv and install lasagne

Choose a name you see fit. I picked “lasagne”.

    pyenv virtualenv 3.5.0 lasagne
    pyenv activate lasagne
    pip3 install --upgrade https://github.com/Theano/Theano/archive/master.zip
    pip3 install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

Wrap up

Reboot your system so that the installed nvidia drivers will load

Usage

Prior to using python, activate the environment with

    pyenv activate lasagne