Forums

keras not working...

I am working on a file that imports the library "keras"

I use python 3.8 using #!/usr/bin/python3.8

when i import keras or tensorflow in a console, it works fine, However, when i run a file that imports keras or tensorflow, it only runs once then when it's run again, it diplays this error message:

TypeError: A Message class can only inherit from Message

an the problem persists unless i close the console and then reopen it

is there any solution for this?

note: i am not using python 3.9 because tensorflow is not available for it

Some libraries cannot be imported twice in the same process and we keep the process around so that runs after the first one are faster. If closing the console fixes the problem, then it would appear that keras is one such library and you need to close the console between runs.