Problem importing Nengo-DL

Hey all,

I have run into an issue with importing Nengo-DL in Google Colab. Whenever I attempt to import, I receive the following error message:

/usr/local/lib/python3.10/dist-packages/nengo_dl/ in <module>
     79     )
     80 else:
---> 81     from keras.engine.functional import Functional, _build_map
     82     from keras.layers import BatchNormalizationV1, BatchNormalizationV2

ModuleNotFoundError: No module named 'keras.engine'

This issue was not present in Colab in the spring, so I tried an older version. When I install an older version of Nengo_DL to import (ex: !pip install nengo-dl==3.4.0) I get a different message:

/usr/local/lib/python3.10/dist-packages/nengo_dl/ in <module>
     11 from packaging import version
     12 from tensorflow.python.keras import engine
---> 13 from tensorflow.python.keras.layers import BatchNormalizationV1, BatchNormalizationV2
     15 from nengo_dl import compat

ImportError: cannot import name 'BatchNormalizationV1' from 'tensorflow.python.keras.layers' (/usr/local/lib/python3.10/dist-packages/tensorflow/python/keras/layers/

Does anyone know any possible solutions for this?

I ran into the exact same “ModuleNotFoundError” running in a python virtual environment on my machine, and I solved it by downgrading my version of nengo and python.
According to Release history — NengoDL 3.6.1.dev0 docs the latest release (3.6) only supports nengo up to version 3.2 and tensorflow up to version 2.11. My code gave a warning about the nengo version not being supported, but downgrading tensorflow solved the ‘No module named keras.engine’ issue.