tensorflow / addons

Useful extra functionality for TensorFlow 2.x maintained by SIG-addons
Apache License 2.0
1.69k stars 611 forks source link

ModuleNotFoundError: No module named 'keras.src.engine' #2865

Open Blessing988 opened 8 months ago

Blessing988 commented 8 months ago

I'm getting below error:

Traceback (most recent call last):
  File "/mmfs1/home/blessing.agyeikyem/Smart-Grid-Monitoring/stargan_v2_tensorflow/main.py", line 11, in <module>
    from StarGAN_v2 import StarGAN_v2
  File "/mmfs1/home/blessing.agyeikyem/Smart-Grid-Monitoring/stargan_v2_tensorflow/StarGAN_v2.py", line 18, in <module>
    from networks import *
  File "/mmfs1/home/blessing.agyeikyem/Smart-Grid-Monitoring/stargan_v2_tensorflow/networks.py", line 11, in <module>
    from ops import *
  File "/mmfs1/home/blessing.agyeikyem/Smart-Grid-Monitoring/stargan_v2_tensorflow/ops.py", line 12, in <module>
    import tensorflow_addons as tfa
  File "/mmfs1/home/blessing.agyeikyem/.local/lib/python3.9/site-packages/tensorflow_addons/__init__.py", line 23, in <module>
    from tensorflow_addons import activations
  File "/mmfs1/home/blessing.agyeikyem/.local/lib/python3.9/site-packages/tensorflow_addons/activations/__init__.py", line 17, in <module>
    from tensorflow_addons.activations.gelu import gelu
  File "/mmfs1/home/blessing.agyeikyem/.local/lib/python3.9/site-packages/tensorflow_addons/activations/gelu.py", line 19, in <module>
    from tensorflow_addons.utils.types import TensorLike
  File "/mmfs1/home/blessing.agyeikyem/.local/lib/python3.9/site-packages/tensorflow_addons/utils/types.py", line 29, in <module>
    from keras.src.engine import keras_tensor
ModuleNotFoundError: No module named 'keras.src.engine'

Tensorflow version = 2.1.0

Tensorflow-addons version = 0.9.1

Keras version = 2.3.1

Ubuntu version = 8.5

fthielke commented 7 months ago

This seems to be fixed in https://github.com/tensorflow/addons/pull/2858, but there has not been a release with those changes.

Try installing tfa-nightly instead.