Setting up Neon machine learning framework on Ubuntu with GPU support

Neon is one of the fastest neural network frameworks out there (see the benchmarks). Today we are going to install it on Ubuntu 16.04 LTS with full GPU support.

I'm going to install Neon on a GPU-enabled Azure virtual machine, but the steps are universal. You can use this manual to install the framework on Ubuntu running on regular PC, or even on “Ubuntu on Windows 10” (just skip the GPU part). I will cover all the required dependencies so you can install Neon on vanilla Ubuntu.

Let's get started.

Install NVidia CUDA libraries

First we will install CUDA libraries to add GPU support. If you wish to use only CPU, you can safely skip this section.

Download current DEB package:

wget -O cuda-deb  

You can go to NVidia's website to check for an updated download. Select Linux → x86_64 → Ununtu → [your version] → deb (local), copy the link and replace one in the command above.

Now install CUDA:

sudo dpkg -i cuda-deb  
sudo apt-get update  
sudo apt-get install cuda  

After installation is finished, add the path /usr/local/cuda/bin: to your /etc/environment's PATH variable (just append to the beginning).

Then execute this commands to modify the PATH and LD_LIBRARY_PATH variables in your current session. You need to do this manually only once, these variables will work as expected after you reboot:

export PATH="/usr/local/cuda/bin:"$PATH  
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/lib:/usr/local/lib:"$LD_LIBRARY_PATH  

Install Anaconda

You might already have Python installed, but I strongly suggest to install Anaconda, since it comes with MKL support out of the box. You won't need to bother with OpenBLAS or MLK installation. All this stuff is important if you want to squeeze maximum performance while training you models on the CPU.

First, download Anaconda.


For an updated version visit and choose a Python-3.5 installer, then copy the link and substitute into the command above.

Now execute


Answer “yes” to all the questions. This will make Anaconda's Python the default Python installation for you. If you don't need this, answer “no” when the installer asks you to add Anaconda to PATH (“no” is the default option).

Install development libraries and compilers

With the next set of commands we will install all the libraries and compilers which are required to install Neon. All commands are rather self-explanatory.

sudo apt-get install git  
sudo apt-get install libavdevice-dev libavformat-dev libavfilter-dev libavcodec-dev libswscale-dev libavutil-dev  
sudo apt-get install libsox-dev  
sudo apt-get install libopencv-dev  
sudo apt-get install libcurl4-gnutls-dev  
sudo apt-get install clang  
sudo apt-get install g++  

Create Anaconda environment and install Neon

Now we've got everything we need to install and run Neon. Let's create a virtual environment first. Python virtual environments are like sandboxes. You create an environment for something, you install and remove stuff, and and all your other environments remain untouched. So let's create an Anaconda environment called “Neon” and activate it:

conda create -n neon pip  
source activate neon  

After that we will clone Neon's Git repository and run the installation:

git clone  
cd neon && make sysinstall  

There should be no errors and Neon should be up and running. To test the installation, execute


Congratulations! You've just taught a small perceptron to recognize MNIST numbers! :)