I have imported the following libraries for my machine learning project but have problem when I try to run my model in the terminal:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras import layers, models
and an error message appears:
ImportError: cannot import name 'cast' from partially initialized module 'keras.src.backend' (most likely due to a circular import) (C:\Users\DELL\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\__init__.py)
Hope someone can help me resolve this error?
Uninstalling and installing keras fixed it for me. I uninstalled keras with:
Then I installed a keras version compatible with my tensorflow version - version compatibility can be found here. In my case, I had tensorflow version 2.14.0, so I installed keras version 2.14.0 with: