Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

How to Install the Neon™ Framework on Ubuntu*

$
0
0

Introduction

The neon™ framework is Intel® Nervana™ Python*-based deep-learning framework designed to use deep neural networks such as AlexNet, VGG, and GoogLeNet.

There are many ways to install the neon framework. Users will need to install additional dependencies and packages in order to install the neon framework successfully.

This article presents a simple step-by-step way to install the neon framework in Ubuntu* 14.04 using the Anaconda* Python distribution. It also guides users through what to do if errors are encountered during the installation process. Additional installation instructions or further troubleshooting can be found here.

Installing the Neon Framework

This section will show how to install neon in a virtual environment. This way neon will be in a self-contained environment with other dependencies and user-preferred Python version different from that of the main environment. Furthermore, Anaconda incorporates the Intel® Math Kernel Library (Intel® MKL), which helps improve the performance of common packages like NumPy*, NumExpr*, SciPy*, and Scikit-learn*.

Follow these steps to install the neon framework:

  1. Install the Anaconda distribution of Python if it is not already there.
    1. Go to the Anaconda download website, select the Download for Linux* option and download either the 2.x or 3.x Python version of Anaconda for 64-bit Linux.
    2. Execute the following command to install Anaconda:
      bash Anaconda2-x.x.x-Linux-x86_64.sh (for python 2.x)
      or
      bash Anaconda3-x.x.x-Linux-x86_64.sh (for python 3.x)


      Note:

      - At the time of this writing, the latest version of Anaconda is 4.3.1. Therefore, the above commands should be written as follow:
      bash Anaconda2-4.3.1-Linux-x86_64.sh (for python 2.x)
      or
      bash Anaconda3-4.3.1-Linux-x86_64.sh (for python 3.x)

      - If Anaconda has been installed, update it to the latest version using the following commands:
      conda update conda
      conda update ananconda
  2. After Anaconda has been installed, create a new conda environment for the neon framework. We’ll name it neon, but you can use any name you want.

    conda create --name neon pip

    conda create --name neon pip

    Figure 1. Create the neon™ framework environment.
    Figure 1. Create the neon™ framework environment.

    Figure 1 shows that the neon framework environment was created successfully.

  3. Activate the new environment using the following command:

    source activate neon

  4. Download the neon framework package using Git*:

    git clone  https://github.com/NervanaSystems/neon.git

    Figure 2. Cloning the neon™ framework from GitHub*.
    Figure 2. Cloning the neon™ framework from GitHub*.

    Figure 2 displays the result when the cloning process is successful.

    Note: if git is not already set up on your computer, you can install it by typing the following:
     

    sudo apt install git

  5. Install the neon framework package using make. Make sure to go to the folder containing the package before using make:

    cd neon && make sysinstall

    Figure 3. Installing the neon™ framework.
    Figure 3. Installing the neon™ framework.

    Figure 3 shows the messages that display when the neon™ framework has been successfully installed.

    If there are errors, the screen will look like that in Figure 4:

     

    Messages that display if errors occur while installing the neon™ framework.Figure 4. Messages that display if errors occur while installing the neon™ framework.

    Figure 5 shows a situation when the neon framework cannot be installed in the system due to missing components.

    Figure 5. Errors messages that display during installation when there are missing components.
    Figure 5. Errors messages that display during installation when there are missing components.

    From Figure 5, it appears that the installation cannot find the file “pillow.” There are two possible reasons: the package containing pillow is corrupted or the package containing pillow has not been installed. The safe way to fix the problem is to uninstall the package and reinstall it. Use the following command to install the package:

    conda install pillow

    To uninstall a package, use the following command:

    conda uninstall <package to uninstall>

    Figure 6. Installing missing components.
    Figure 6. Installing missing components.

    Figure 6 shows how to install missing components for the neon framework.

  6. Deactivate the environment when the installation completes:

    source deactivate neon

    Figure 7. Deactivating the neon™ framework environment.
    Figure 7. Deactivating the neon™ framework environment.

Testing the Neon Framework Installation

To ensure the neon framework is installed correctly, run the MNIST multi-layer perceptron example included in the package. This example is running on a CPU as a CPU was detected and parameters were not changed to run on available GPU. Follow these steps to run the example:

You will see the prompt change to reflect the activated environment. To start the neon framework and run the MNIST multi-layer perceptron example:

  1. Activate the neon framework environment.
    source activate neon
  2. Run the example by issuing the following command:
    examples/mnist_mlp.py

    Figure 8. Running examples under the neon™ framework.
    Figure 8. Running examples under the neon™ framework.

    If the example is running correctly, you will see something similar to that in Figure 8.

  3. Deactivate the environment when you are finished running the example.

    Source deactivate neon

Conclusion

This article described a simple way to install the neon framework on Ubuntu using the Anaconda Python distribution.


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>