Fish Yu
Fish Yu

Reputation: 95

Problems to be solved when import keras

I've just install keras for deep learning research, however when I import keras,it shows:

import keras
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/keras/__init__.py", line 2, in <module>
from . import backend
File "/usr/local/lib/python3.5/dist-packages/keras/backend/__init__.py", line 31, in <module>
_config = json.load(open(_config_path))
File "/usr/lib/python3.5/json/__init__.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 6 column 5 (char 85)

I don't know how to handle it, please give me some advice. Thanks in advance!

Upvotes: 1

Views: 261

Answers (1)

pnkfelix
pnkfelix

Reputation: 3890

The output you are seeing there is a stack trace, indicating that some error has occurred. The top line of the stack trace is where your program first entered the function call chain that eventually resulted in some error, and the last line is the end of that chain, the spot where the error actually occurred.

In this case, we see the rather specific error message:

json.decoder.JSONDecodeError: Expecting ',' delimiter: line 6 column 5 (char 85)

I interpret this as saying that there is something malformed in your JSON input. JSON is a relatively simple data encoding format (its documented in a single web page), and the error says that it sees a problem very early in your input stream (you can either count 85 characters in your input file, or you can jump down to line 6 and then step 5 columns to the right on that line).

So the real question is: Do you know where that JSON file is located? From the stack trace, it sounds like it is at some "config path"; maybe there is some configuration file that you edited, but left out a comma in it?

Upvotes: 1

Related Questions