Import nengo_dl

I‘m trying to import nengo_dl, while it shows the following mistakes:

source code:
import nengo_dl

mistake:
Traceback (most recent call last):
File “/home/LIF/test.py”, line 2, in
import nengo_dl
File “/home/anaconda3/envs/nengo_dl/lib/python3.5/site-packages/nengo_dl/init.py”, line 32, in
from nengo_dl.compat import tf_compat
File “/home/anaconda3/envs/nengo_dl/lib/python3.5/site-packages/nengo_dl/compat.py”, line 53, in
if LooseVersion(nengo.version) < “3.0.0”:
AttributeError: module ‘nengo’ has no attribute ‘version

nengo_dl: 2.2.0

It seems like your nengo package is not installed correctly. You could try reinstalling via

pip uninstall nengo
pip install nengo

and see if that fixes it?

Another possibility is that you have a folder named nengo in the home/snn/LIF directory (so when it tries to import nengo it is importing that folder, rather than the nengo package).

Yep, I have fixed it. Thanks.:clap:

I named a python file under this folder as nengo.py, which is the reason as you said. Hence, I removed this file, reinstall nengo package and everything is good now.

1 Like