Appendix A. Installing Keras and its dependencies on Ubuntu

 

The process of setting up a deep-learning workstation is fairly involved and consists of the following steps, which this appendix will cover in detail:

  1. Install the Python scientific suite—Numpy and SciPy—and make sure you have a Basic Linear Algebra Subprogram (BLAS) library installed so your models run fast on CPU.
  2. Install two extras packages that come in handy when using Keras: HDF5 (for saving large neural-network files) and Graphviz (for visualizing neural--network architectures).
  3. Make sure your GPU can run deep-learning code, by installing CUDA drivers and cuDNN.
  4. Install a backend for Keras: TensorFlow, CNTK, or Theano.
  5. Install Keras.

It may seem like a daunting process. In fact, the only difficult part is setting up GPU support—otherwise, the entire process can be done with a few commands and takes only a couple of minutes.

We’ll assume you have a fresh installation of Ubuntu, with an NVIDIA GPU available. Before you start, make sure you have pip installed and that your package manager is up to date:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python-pip python-dev

A.1. Installing the Python scientific suite

A.2. Setting up GPU support

A.3. Installing Theano (optional)

A.4. Installing Keras