notebook
notebook copied to clipboard
jupyter notebook list show error "json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)"
In base conda environment, I run
jupyter notebook list
It show error
Traceback (most recent call last):
File "/home/cpu11453/miniconda3/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/cpu11453/miniconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/cpu11453/miniconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.start()
File "/home/cpu11453/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 2195, in start
super(NotebookApp, self).start()
File "/home/cpu11453/miniconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 259, in start
self.subapp.start()
File "/home/cpu11453/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 596, in start
serverinfo_list = list(list_running_servers(self.runtime_dir))
File "/home/cpu11453/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 2295, in list_running_servers
info = json.load(f)
File "/home/cpu11453/miniconda3/lib/python3.7/json/__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/home/cpu11453/miniconda3/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/home/cpu11453/miniconda3/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/cpu11453/miniconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Expectation: list all running instance if any.
You can refer to this link.
jupyter notebook list simply reads JSON files named nbserver-pid.json in the Jupyter runtime directory (found via jupyter --runtime). Check those files to ensure there's nothing out of the ordinary. The content should be JSON and resemble the following...
{
"base_url": "/",
"hostname": "localhost",
"notebook_dir": "/Users/kbates/.jupyter",
"password": false,
"pid": 39736,
"port": 8888,
"secure": false,
"sock": "",
"token": "78905550521d33869297b7a8e0a7618ab990da77091f7764",
"url": "http://localhost:8888/"
}
i went there it was fine but i cant solve the problem yet
Just create a folder in the Jupyter runtime directory. Backup by Moving all the .json files there. Then start a new notebook and try 'jupyter notebook list' again.
I've run into this issue as well.
I'm also seeing this, has anyone found a solution?
Edit: bf2harven's solution above worked for me, though its unclear why this is happening and whether it will happen again...
Temporary solution of
- Moving all the jsons from the folder resulting in
jupyter --runtime-dirto another folder - start new
jupyter notebook jupyter notebook listseem to resolve decode error but has a blank input just asjupyter lab listjupyter server listhowever runned instances are seen inps aux | grep jupyterwhich is suprising due to https://github.com/jupyter/notebook/issues/2254#issuecomment-317709079
I just deleted the folder: /home/USER/.local/share/jupyter And restarted jupyter lab. Then it was working for me. Jupyter lab will create this folder again after starting. But attention: Some settings might get lost! It is therefore maybe worth saving the folder just in case you want to recover it again.
I had an empty page_config.json in ~/.jupyter/labconfig
removing it solved the issue of jupyter lab throwing JSONDecodeError