Getting started

Nengo runs on Windows, Mac OS X and Linux and requires Python. To install Nengo, we recommend using pip.

pip install nengo nengo-gui

To make sure that the installation worked, run

nengo

and you should see a message about the Nengo server starting, and a webpage will open with the NengoGUI environment.

If you do not have pip installed, or if you run into any errors when installing Nengo with pip, expand the sections below for more detailed instructions.

pip will do its best to install all of Nengo’s requirements when it installs Nengo. However, if anything goes wrong during this process, you can install Nengo’s requirements manually before doing pip install nengo again.

Nengo's only required dependency is NumPy, and we recommend that you install it first. The best way to install NumPy depends on several factors, such as your operating system. Briefly, what we have found to work best on each operating system is:

  • Windows: Use Anaconda, Miniconda, or the official installer and unofficial binaries
  • Mac OS X: Use Anaconda, Miniconda, or Homebrew.
  • Linux: Use Anaconda, Miniconda, or your OS's package manager.

Anaconda provides an all-in-one solution that will install Python, NumPy, and other optional Nengo dependencies. It works on all operating systems (Windows, Mac, Linux) and does not require administrator privileges. It includes GUI tools, as well as a robust command line tool, conda, for managing your Python installation.

Run the graphical installer for your operating system to install it. Unless you have a reason to stay with Python 2, opt for the Python 3 installer. Once Anaconda is installed, open the Anaconda command prompt and do

pip install nengo nengo-gui

to complete Nengo installation.

Miniconda gives you the convenience of the conda command line tool without having to download a ton of packages you might not use. After running the Miniconda installer, open the command prompt and do

conda install numpy pip
pip install nengo nengo-gui

to install Nengo and its dependencies.

On Mac OS X, Homebrew has excellent Python support. After installing Homebrew:

brew install python
pip install numpy
pip install nengo nengo-gui

will install Nengo and its dependencies.

In Debian, Ubuntu, and other distributions that use apt, do:

sudo apt install python-numpy python-pip
pip install nengo nengo-gui

In Fedora, CentOS, and others distributions that use yum, do:

sudo yum install python-numpy python-pip
pip install nengo nengo-gui

If speed is an issue and you know your way around a terminal, installing NumPy from source is flexible and performant. See the detailed instructions here.

Once NumPy is installed, you can install Nengo with pip install nengo nengo-gui

Running models

Once you have Nengo installed, there are two ways to run Nengo models. They can be run either with the NengoGUI, or they can be run with a Python interpreter.

With NengoGUI

The NengoGUI is a web-based interface for designing and running Nengo models. To start the GUI, open a terminal and run the nengo command.

To access the GUI, you use a web browser like Google Chrome or Firefox. You should see a depiction of the network on the left panel, and a code editor on the right panel.

NengoGUI

The network illustration on the left panel is interactive. You can drag to move the network objects, scroll with the mouse to zoom in and out, and right-click on objects to display plots that will update in real time as the model simulates (see the GUI documentation for more details).

The code editor on the right panel shows the Python code defining the Nengo model. While you can write any Python code in this editor, we add a few additional constraints to ensure the GUI runs smoothly:

  • Your top-level network must be called model.
  • You cannot construct a Simulator object, as the GUI makes its own Simulator under the hood.
  • You cannot show plots created with Matplotlib, as the GUI has its own set of visualizations.

To access a series of tutorials that introduce you to the GUI and to the basics of building models with Nengo, click on the folder icon at the top-left of the GUI, select “built-in examples”, and then “tutorial”.

If you see a warning that says something like Warning: Simulators cannot be manually run inside nengo_gui, then you are likely running a model that is designed to run with a Python interpreter (see below for details). If the model you are trying to run is a Nengo example, then it’s likely that a similar example exists within the built-in examples accessible through the folder icon at the top-left of the GUI.

With a Python interpreter

The Nengo core is written in Python. In order to install Nengo, you likely also installed a Python distribution, whether it be through a package manager provided by your operating system, through Anaconda, or by some other means. You can use Nengo through any Python interpreter, like any other Python package.

All Python distributions come with an interpreter that you can usually run through a terminal by typing in python and hitting enter. You should see a prompt that looks like this:

$ python
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

You can then import nengo and start building models.

>>> import nengo
>>> model = nengo.Network("My model")

Since Nengo is a normal Python package, it interacts well with other Scientific Python packages, including plotting libraries like Matplotlib.

The Jupyter notebook provides another way to run Python scripts. We provide Nengo core examples as Jupyter notebooks because you can see plots in the same interface as the code. Jupyter notebooks are also text files, but have the extension .ipynb. These are run through the Jupyter notebook. To try this out, download single-neuron.ipynb (press Ctrl+s to save the notebook if it doesn’t download automatically). Then open a terminal, enter

$ jupyter notebook

and click on single-neuron.ipynb to run the example. After running all the cells, you should see these plots.

To access a series of tutorials that use Nengo with a Python interpreter, see the Nengo documentation.

Learning more

Reference

The following links are useful to refer to when building models.