Appendix A. Installing Keras and its dependencies on Ubuntu

 

This appendix provides a step-by-step guide to configuring a deep-learning workstation with GPU support on Ubuntu. You should also consult https://tensorflow.rstudio.com/tools/local_gpu, which is an up-to-date guide to local GPU configuration for all platforms.

A.1. Overview of the installation process

The process of setting up a deep-learning workstation is fairly involved. It consists of the following steps, which we’ll cover in detail:

  1. Installing some system-level prerequisites, including a Basic Linear Algebra Subprogram (BLAS) library so your models run fast on CPU
  2. Making sure your GPU can run deep-learning code, by installing CUDA drivers and cuDNN
  3. Installing Keras and the TensorFlow backend

It may seem like a daunting procedure. 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.

A.2. Installing system prerequisites

Keras is implemented in Python and depends on the Python package manager pip for its installation. To begin, 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

You should also install a BLAS library (OpenBLAS, in this case), to ensure that you can run fast tensor operations on your CPU:

A.3. Setting up GPU support

A.4. Installing Keras and TensorFlow