from keras.models import load-model error

273 views
Skip to first unread message

Janaki Patwardhan

unread,
Nov 7, 2023, 2:17:20 AM11/7/23
to Keras-users
Hello

I am using anaconda environment
Tensorflow 2.13.0
Keras2.15.0
python 3.8.18  in my enviroment

i get error for the line
from keras.models import load-model 
as follows:

File "fmd_backend.py", line 196, in <module>
    from keras.models import Model,load_model
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\__init__.py", line 3, in <module>
    from keras import __internal__
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\__internal__\__init__.py", line 3, in <module>
    from keras.__internal__ import backend
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\__internal__\backend\__init__.py", line 3, in <module>
    from keras.src.backend import _initialize_variables as initialize_variables
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\src\__init__.py", line 21, in <module>
    from keras.src import applications
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\src\applications\__init__.py", line 18, in <module>
    from keras.src.applications.convnext import ConvNeXtBase
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\src\applications\convnext.py", line 26, in <module>
    import tensorflow.compat.v2 as tf
ModuleNotFoundError: No module named 'tensorflow.compat'

Please advise how to correct this.  Thanks.

tagoma

unread,
Nov 7, 2023, 3:41:44 AM11/7/23
to Keras-users
What is the name of the .py file you are running?
Could this be it is the name as one of the files in the Tensorflow library, creating confusion?
Reply all
Reply to author
Forward
0 new messages