ModuleNotFoundError: No module named 'keras.src'

I am trying to create a web service in Render but I get “ModuleNotFoundError: No module named ‘keras.src’” error. I need to use Keras from tensorflow library but I have got an error with the following import statement in Python code.

from tensorflow import keras

In the requirements.txt, the version of tensorflow is written as “tensorflow==2.11.0”. This is the latest version that I can import with Render. I think the error may be related with the issue as keras is embedded into Tensorflow since a specific version of Tensorflow and the current version may not support Keras. Is there anybody who can propose a solution for this problem?

Hi there,

Try updating your Python version to 3.9 so you can use the latest version TensorFlow and Keras. The only information I could find on this was from this Stack Overflow post which suggests older versions of Keras don’t support Pickle which I believe is where this error comes from.

Regards,

Keith
Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.