Keras Import Error

While importing keras (from keras.models import Sequential), I am getting the following error:

Traceback (most recent call last):

 File "/home/afzal/Deep cnn/cnn_deeplearningpgm/keras_cnn_new3.py",
 line 2, in module
     import keras   File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/__init__.py",
 line 2, in module
     from . import backend   File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/backend/__init__.py",
 line 29, in module
     _config = json.load(open(_config_path))   File "/usr/lib/python2.7/json/__init__.py", line 291, in load
     **kw)   File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
     return _default_decoder.decode(s)   File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
     obj, end = self.raw_decode(s, idx=_w(s, 0).end())   File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
     obj, end = self.scan_once(s, idx) ValueError: Expecting object: line 5 column 25 (char 108)

I have installed theano. Could anyone help me solve this?

Topic json keras theano

Category Data Science


Looks like your ~/.keras/keras.json is either missing or incorrect.

Try deleting ~/.keras and running import keras, this should re-create blank config. You may need to edit it to set backend to Theano.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.