Spaun 2.0 fails with "ModuleNotFoundError: No module named 'nengo.utils.compat'"

Here’s the output:

Traceback (most recent call last):
  File "run_spaun.py", line 10, in <module>
    from _spaun.configurator import cfg
  File "/home/#####/Downloads/spaun2.0-master/_spaun/configurator.py", line 10, in <module>
    from ._spa import MemoryBlock as MB
  File "/home/#####/Downloads/spaun2.0-master/_spaun/_spa/__init__.py", line 2, in <module>
    from .mem_block import MemoryBlock
  File "/home/#####/Downloads/spaun2.0-master/_spaun/_spa/mem_block.py", line 8, in <module>
    from .._networks import InputGatedMemory as WM
  File "/home/#####/Downloads/spaun2.0-master/_spaun/_networks/__init__.py", line 1, in <module>
    from .workingmemory import InputGatedMemory
  File "/home/#####/Downloads/spaun2.0-master/_spaun/_networks/workingmemory.py", line 8, in <module>
    from .assoc_mem import AssociativeMemory
  File "/home/#####/Downloads/spaun2.0-master/_spaun/_networks/assoc_mem.py", line 9, in <module>
    from nengo.utils.compat import is_iterable, range
ModuleNotFoundError: No module named 'nengo.utils.compat'

Thank you.

Hi @gonen, and welcome to the Nengo forums. :smiley:

The Spaun 2.0 code base hasn’t been updated to support the latest version of Nengo.
The nengo.utils.compat module was removed in Nengo 3.0.0 (and up), so you’ll need to use nengo<3.0.0 in your Python environment when working with Spaun 2.0.

You can install a previous version of Nengo with:
pip install "nengo<3.0.0"

Thanks, now I get this error

(base) #####@pop-os:~/Downloads/spaun2.0-master$ python run_spaun.py 
/home/#####/Downloads/spaun2.0-master/_spaun/utils.py:62: SyntaxWarning: "is" with a literal. Did you mean "=="?
  ("" if suffix is '' else '(' + suffix + ')') + "." + ext
NOT USING CACHE
BACKEND: REF

======================== RUN 1 OF 1 ========================
MODEL SEED: 1611888704
Traceback (most recent call last):
  File "run_spaun.py", line 606, in <module>
    from _spaun.spaun_main import Spaun
  File "/home/#####/Downloads/spaun2.0-master/_spaun/spaun_main.py", line 8, in <module>
    from .modules import Stimulus, Vision, ProdSys, RewardEval, InfoEnc
  File "/home/#####/Downloads/spaun2.0-master/_spaun/modules/__init__.py", line 4, in <module>
    from .vision_system import VisionSystem as Vision
  File "/home/#####/Downloads/spaun2.0-master/_spaun/modules/vision_system.py", line 14, in <module>
    from .vision import vis_data, VisionNet, VisionNetClassifier
  File "/home/#####/Downloads/spaun2.0-master/_spaun/modules/vision/__init__.py", line 5, in <module>
    vis_data = vis_module.DataObject()
  File "/home/#####/Downloads/spaun2.0-master/_spaun/modules/vision/lif_vision/data.py", line 24, in __init__
    self.weights = self.vision_network_data['weights']
  File "/home/#####/anaconda3/lib/python3.8/site-packages/numpy/lib/npyio.py", line 253, in __getitem__
    return format.read_array(bytes,
  File "/home/#####/anaconda3/lib/python3.8/site-packages/numpy/lib/format.py", line 727, in read_array
    raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

Oh… The Spaun 2.0 codebase is a little old.
For the SyntaxWarning, use Python<3.8.
For the pickle error, you’ll need to use numpy<=1.16.2

After this, if you get an error regarding importing the py3LinkArm dll, there is a README.txt in _spaun/arms/three_link that’ll instruct you on how to build the dll. Since you are using Linux, it’s relatively simple:

  1. Pip install Cython into your environment: pip install cython
  2. Make sure you have gcc installed on your system: sudo apt install build-essential
  3. From the _spaun/arms/three_link folder, run python setup.py build_ext -i