Nengo convolution error

Hi all,
I tried to run the Convolutional Networks example in the NengoLoihi and this error is issued
AttributeError: module ‘nengo’ has no attribute ‘convolution’. What the lib did I miss? I already installed nengo, nengo_dl and nengo_loihi … Thank you

def conv_layer(x, *args, activation=True, **kwargs):
# create a Conv2D transform with the given arguments
conv = nengo.Convolution(*args, channels_last=False, **kwargs)

if activation:
    # add an ensemble to implement the activation function
    layer = nengo.Ensemble(conv.output_shape.size, 1).neurons
    # no nonlinearity, so we just use a node
    layer = nengo.Node(size_in=conv.output_shape.size)

# connect up the input object to the new layer
nengo.Connection(x, layer, transform=conv)

# print out the shape information for our new layer
print(conv.input_shape.shape, "->", conv.output_shape.shape)

return layer, conv

—end code—
The error is
— error–
AttributeError Traceback (most recent call last)
in ()
27 # build parallel copies of the network
28 for _ in range(n_parallel):
—> 29 layer, conv = conv_layer(inp, 1, input_shape, kernel_size=(1, 1), init=np.ones((1,1,1,1)))
30 # first layer is off-chip to translate the images into spikes
31 net.config[layer.ensemble].on_chip = False

in conv_layer(x, activation, *args, **kwargs)
1 def conv_layer(x, *args, activation=True, **kwargs):
2 # create a Conv2D transform with the given arguments
----> 3 conv = nengo.convolution(*args, channels_last=False, **kwargs)
5 if activation:

AttributeError: module ‘nengo’ has no attribute ‘convolution’
— end error----

The nengo.Convolution class is new, and not yet released. To use it, you need to install the development version of Nengo. The easiest way to do this is

pip uninstall nengo
pip install git+

Oh I see, thank you

Hello Eric,

I also have this issue with Convolutional Networks example and after I finished the steps you recommended, a new problem occurred in the import section. What’s your suggestion? Thanks in advance.

WARNING:tensorflow:From /anaconda3/envs/loihi/lib/python3.5/site-packages/tensorflow_core/python/compat/ disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term

ImportError Traceback (most recent call last)
in ()
8 import nengo
----> 9 import nengo_dl
10 import numpy as np
11 import matplotlib.pyplot as plt

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_dl/ in ()
61 # import into top-level namespace
62 from nengo_dl import dists, objectives
—> 63 from nengo_dl.simulator import Simulator
64 from nengo_dl.tensor_node import TensorNode, tensor_layer, reshaped
65 from nengo_dl.config import configure_settings

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_dl/ in ()
32 from nengo_dl.builder import NengoBuilder, NengoModel
33 from nengo_dl.compat import tf_compat, Convolution
—> 34 from nengo_dl.tensor_graph import TensorGraph

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_dl/ in ()
24 import tensorflow as tf
—> 26 from nengo_dl import builder, graph_optimizer, signals, utils, tensor_node, config
27 from nengo_dl.compat import (
28 tf_compat,

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_dl/ in ()
9 from nengo.builder.operator import ElementwiseInc, DotInc, Reset, Copy
10 from nengo.exceptions import BuildError
—> 11 from nengo.utils.compat import iteritems
12 from nengo.utils.graphs import toposort, BidirectionalDAG
13 from nengo.utils.simulator import operator_dependency_graph

ImportError: No module named ‘nengo.utils.compat’

It looks like you’re using the development version of Nengo, which has some recent changes that are not yet supported in NengoDL. If you install the latest Nengo release (2.8.0), then everything should work fine. Alternatively, this will soon be fixed in the development version of NengoDL. So if you follow this PR, once that is merged in then you can install the development version of NengoDL and again everything should work fine.


I installed the Nengo 2.8.0 and now my nengo packegaes are
nengo 2.8.0
nengo-dl 2.2.1
nengo-gui 0.4.5
nengo-loihi 0.8.0

when I ran the same example which is “Convolutional Networks example” in the NengoLoihi, I got the error:

ImportError Traceback (most recent call last)
in ()
17 has_requests = False
—> 19 import nengo_loihi

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_loihi/ in ()
5 del check_nengo_version
----> 7 from .simulator import Simulator
8 from .config import add_params, set_defaults

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_loihi/ in ()
14 import numpy as np
—> 16 from nengo_loihi.builder import Model
17 from nengo_loihi.builder.nengo_dl import HAS_DL, install_dl_builders
18 from nengo_loihi.compat import seed_network

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_loihi/builder/ in ()
1 from .builder import Builder, Model
----> 2 from . import connection, ensemble, node, probe

/anaconda3/envs/loihi/lib/python3.5/site-packages/nengo_loihi/builder/ in ()
4 import nengo
5 from nengo import Ensemble, Connection, Node, Probe as NengoProbe
----> 6 from nengo.builder.connection import (
7 build_no_solver as _build_no_solver,
8 BuiltConnection,

ImportError: cannot import name ‘multiply’

I even got the same error in the example “COMMUNICATION CHANNEL” which works fine before.

I want to use nengo loihi, which version for these packages should I install?

nengo, nengo-dl, and nengo-loihi have all now been updated. So if you use the most recent versions (nengo 3.0, nengo-dl 2.2.2, and nengo-loihi 0.9.0), then everything should work for you. Sorry for the delays as we updated all these packages for the major Nengo 3.0 release!