Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

keras

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'
like image 248
AmaniAli Avatar asked Jul 16 '26 00:07

AmaniAli


1 Answers

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

like image 117
MHP Avatar answered Jul 18 '26 19:07

MHP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!