Setting up Deep Learning libraries in SystemLink™

National Instrument’s SystemLink™ is a powerful tool that enables data collection, storage, and tagging and is the basis for Machine Learning. SystemLink™ makes it easy to introduce Machine Learning into your workflow using Python Jupyter Notebook.

Advancements in Deep Learning is helping in addressing problems that were not possible earlier and SystemLink™ server can be used to build and deploy solutions that leverage deep learning. In this article, we will walk you through the steps to make SystemLink™ deep learning ready. This blog is a part of the series – Leverage SystemLink™ for Machine Learning.

SystemLink™’s JupyterHub plugin comes with most of the popular Python data manipulation libraries pre-installed including sklearn for machine learning. In this article, we’ll see how to set up the deep learning libraries like Keras and Tensorflow in SystemLink™. Such libraries do not come pre-installed with SystemLink™, as they have to be compiled appropriately depending on the server machine (the server can be a CPU or a GPU).

Typically you would install a library using the pip install command. If you try that you’ll end up installing keras in the default python in your PC, which you’ll not be able to access from the SystemLink™’s JupyterHub, as it runs its own copy of Python, not the default one.

You can follow the below steps to install keras in the right place.

Step 1: Find the path of the python libraries being used by the JupyterHub

– Open a new notebook in the JupyterHub plugin
– Import sys library
– Print sys.path and find the path of the python used by the SystemLink™’s Jupyter Notebook from the list of paths printed.
import sys
print(sys.path)

Step 2: Install Keras library in the site-packages folder of the NI SystemLink™’s Python

– Go to the Python path which you have found in the previous step and navigate to the Scripts folder.
– Open a command prompt as administrator in the Source folder, where pip3 can be found
– Make use of this pip3 to install the required packages
pip install tensorflow
pip install keras

Step 3: Verify installation

– After installing you can verify the installation by importing the libraries in a notebook by running
import tensorflow
import keras

– You should not be getting any import errors

This way of installing libraries is applicable for installing any python library which is not pre-installed in SystemLink™’s Python.

Written by Raghul Ravichandran May 5, 2019 Machine Learning

 

Share with