The error arises due to mismatch between the versions.TensorFlow==2.15 overwrites keras with an older version(keras==2.15
). If you install TensorFlow 2.15, you should reinstall keras 3 afterwards. This step is not necessary for TensorFlow versions 2.16 onwards, it will install Keras 3 by default. So to fix this issue issue, you can either upgrade your TensorFlow version or manually install keras==3.0
after installing TensorFlow 2.15 and import keras
directly instead of using from tensorflow import keras
. kindly refer to this document. And also refer this gist.