Skip to content
Sandeep Krishnamurthy edited this page Jul 3, 2017 · 22 revisions

Installation

1 Install Keras with MXNet backend

Warning Keras with MXNet backend is still in experimental Beta phase. You can view the list of known issues and unsupported functionalities here.

Steps involved

  1. Install Keras dependencies - Numpy, Nose, Tensorflow and Theano
  2. Install Keras from source - https://github.com/dmlc/keras
  3. Install MXNet from source - https://github.com/dmlc/mxnet

Note: The following installation instructions are tested on Ubuntu 14.04/16.04 and Mac OS EL Capitan and Sierra.

1.1 Install Keras Dependencies

You need to install pip if not already installed. Then, follow the below installation commands to install Keras dependencies.

    $ pip install numpy
    $ pip install nose
    $ pip install nose-parameterized
    $ pip install Theano

    # Refer https://www.tensorflow.org/install/ for more detailed Tensorflow installation instructions. 
    $ pip install tensorflow  # For CPU machines
OR
    $ pip install tensorflow-gpu # For GPU machines

1.2 Install Keras from source

    # Clone keras repo to ~/keras directory
    $ git clone https://github.com/dmlc/keras.git ~/keras --recursive
    # Install Keras
    $ cd ~/keras
    $ sudo python setup.py install

1.3 Install MXNet from source

Note You need to install MXNet from latest source code to get Keras working with MXNet backend.

Go to MXNet Installation guide, choose "Linux or MacOS", choose "Python", choose "CPU or GPU", choose "Build from Source" and follow the installation guide to build and install MXNet with Python bindings.

2 Configure Keras backend

You should set Keras backend to 'mxnet' to run your Keras code with MXNet backend. You can either set the environment variable or edit the keras config file.

Option 1 Set the environment variable

    $ export KERAS_BACKEND=mxnet

Option 2 Edit the keras config file

Open "~/.keras/keras.json" file and set "backend=mxnet".

3 Validate the Installation

You can validate the installation by trying to import Keras in Python terminal and verifying that Keras is using mxnet backend.

    $ python
    >>> import keras as k
        Using mxnet backend
Clone this wiki locally