Search code examples
pythonkeras

Error while import keras: AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'register_clear_session_function'


I want to import keras after I did pip install keras, but it shows message as shown below. I even can't call any function from keras library. Can anyone know about this?

import keras

Error:

AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'register_clear_session_function'

Solution

  • you should use import tensorflow.keras instead of import keras. More info here.