Installing nengo_loihi - abr/telluride-nengo GitHub Wiki

If you will be connecting to a Loihi board, you will need to perform these steps on the superhost machine (the machine connected to the Loihi board). Make sure you're connected and logged in to the super host before doing this.

If you are just going to be running your model in simulation, you can perform these same steps on your local machine, and omit the NxSDK installation step at the end.

Step 1: Clone the nengo-loihi repository

  1. Ensure that you have git, ssh, and the nengoloihi/nengoloihi.pub SSH key pair. If you do not have the key pair, talk to Chris or Terry to get it.

  2. Install the SSH key.

    a. If you do not have a ~/.ssh/id_rsa file:

    mkdir -p ~/.ssh
    mv nengoloihi ~/.ssh/id_rsa
    mv nengoloihi.pub ~/.ssh/id_rsa.pub
    chmod 600 id_rsa
    

    b. If you already have a ~/.ssh/id_rsa file:

    eval $(ssh-agent -s)
    ssh-add nengoloihi
    ssh-add -l # The nengo-loihi key should be listed
    

3a. Clone the repository. (If you're on intel's cloud, see 3b):

git clone ssh://[email protected]:36563/abr/nengo-loihi.git

If you've set up the SSH key correctly, git should not prompt you for a password.

3b. If you're on Intel's cloud, you have to make a local clone (i.e. on your machine). Follow the instructions above on your computer (instead of on a superhost).

Then you can rsync it to the cloud account from the parent folder of nengo-loihi:

rsync nengo-loihi [email protected]:~ -r

Step 2: Set up a conda environment

  1. It is highly recommended to use a python virtual environment to runnengo_loihi models. The steps below will show you how to set up a virtual environment using the conda package.

    a. If you are on your own machine or Intel's servers, install it using these instructions. Here's a summary: - In your home directory type: bash wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh Then follow the prompts, being generally agreeable.

    b. If you are on the super host machine: Add conda to your path by editing your .bashrc. Start the editor using the following:

    pico ~/.bashrc
    

    Then add this line at the end of the file:

    export PATH=/opt/miniconda3/bin:$PATH
    

    Save and close the file. Now close that terminal and open a new one (or ssh back in).

  2. Create a new conda environment.

    conda create --name loihi python=3.5.5
    

    If you will be connecting to a Loihi board, you must use a Python version after 3.5.2 and before 3.6.0. We recommend 3.5.5.

  3. Activate your new environment.

    source activate loihi
    

    Sometimes when creating the environment, you will start in that environment, but the path will not be updated correctly. Before continuing to the next step, please ensure that which pip shows the pip associated with your conda environment.

    Note: Ensure you always activate your environment after you log off and back on to the super host.

  4. Install nengo_loihi.

    cd nengo-loihi # This is the cloned repository from step 1
    pip install -e .
    

    Make sure to include the . in the pip command above.

Step 3: Install NxSDK

NxSDK is Intel's Python SDK for Loihi. If you want to run Nengo models of real Loihi hardware, you will need to install NxSDK. If you're on Intel's server see 1.b.

1a. Clone the latest version of the repo:

cd ~
git clone /etc/NxSDK/.git
cd NxSDK

1b. Clone when on Intel's servers

cd ~
git clone /nfs/ncl/git/NxSDK.git 
cd NxSDK
  1. Check out the 0.5 tag, which is the most recent release. (Note: or 0.5.1 might be, please check)

    git checkout 0.5
    
  2. Add a setup.py file. You can paste this at your command prompt:

    cat > setup.py << 'EOL'
    import sys
    from setuptools import setup
    
    if not ((3, 5, 2) <= sys.version_info[:3] < (3, 6, 0)):
        pyversion = ".".join("%d" % v for v in sys.version_info[:3])
        raise EnvironmentError(
            "NxSDK has .pyc files that only work on Python 3.5.2 through 3.5.5. "
            "You are running version %s." % pyversion)
    
    setup(
        name='nxsdk',
        version='0.5.0',
        install_requires=[
            "numpy",
            "pandas",
            "matplotlib",
            "teamcity-messages",
            "rpyc<4",
        ]
    )
    EOL
    

    or paste the text above (excluding the first and last lines) into an editor and save as setup.py in the NxSDK folder.

  3. Install nxsdk

    pip install -e .
    

Step 4: Configuring the matplotlib plotting options

  1. Check that you have a folder called matplotlib in the .config folder in your home directory.
    cd ~
    cd .config/matplotlib
    
    If it doesn't exist, check that the matplotlib python package has been installed correctly in your python virtual environment, and if needed, create the matplotlib folder.
  2. Add the matplotlib backend option to a matplotlibrc file in the ~/.config/matplotlib/ folder:
    echo "backend: Agg" >> matplotlibrc