Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange error with Keras and Spyder

I'm using Spyder to do some small projects with Keras, and every now and then (I haven't pinned down what it is in the code that makes it appear) I get this message:

  File "~/.local/lib/python3.5/site-packages/google/protobuf/descriptor_pb2.py", line 1771, in <module>
    __module__ = 'google.protobuf.descriptor_pb2'

TypeError: A Message class can only inherit from Message

Weirdly, this exception is not raised if I execute the program outside of Spyder, using the terminal. I've looked around and I have found no one who has encountered this error while using Keras.

Restarting Spyder makes it go away, but it's frustrating. What could be causing it?

like image 230
carllacan Avatar asked Aug 26 '17 10:08

carllacan


2 Answers

I had the same problem with Spyder, which happened when it was trying to reload modules that were already loaded. I solved it by disabling the UMR (User Module Reloader) option in "preferences -> python interpreter" .

like image 109
Adrien Deliège Avatar answered Nov 02 '22 11:11

Adrien Deliège


Ok, I found the cause: interrupting the execution before Keras fully loads.

As said before restarting Spyder (or just the console) solves it.

like image 30
carllacan Avatar answered Nov 02 '22 11:11

carllacan