Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jupyter notebook list - json.decoder.JSONDecodeError: #2416

Open
ArunNairID opened this issue Apr 16, 2017 · 16 comments
Open

jupyter notebook list - json.decoder.JSONDecodeError: #2416

ArunNairID opened this issue Apr 16, 2017 · 16 comments

Comments

@ArunNairID
Copy link

(root) C:\Users\Arun>jupyter notebook list

Currently running servers:
http://localhost:8890/?token=d70754b078073066f1c8003b303db1bf02a2a6e0eb2a4081 :: c:\Users\Arun\Github\Notebook\python-machine-learning-book-master
http://localhost:8888/?token=969aa0d7636e12fb85b8bca99671887456c71c682b048352 :: c:\Users\Arun\Github\Sublime
http://localhost:8889/?token=ed5ad57d94e7ff7ad72b4be87721807605e44297398b96f0 :: c:\Users\Arun\Github\Sublime
Traceback (most recent call last):
File "C:\Users\Arun\Anaconda3\Scripts\jupyter-notebook-script.py", line 5, in
sys.exit(notebook.notebookapp.main())
File "C:\Users\Arun\Anaconda3\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\Arun\Anaconda3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Users\Arun\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1197, in start
super(NotebookApp, self).start()
File "C:\Users\Arun\Anaconda3\lib\site-packages\jupyter_core\application.py", line 256, in start
self.subapp.start()
File "C:\Users\Arun\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 308, in start
for serverinfo in list_running_servers(self.runtime_dir):
File "C:\Users\Arun\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1278, in list_running_servers
info = json.load(f)
File "C:\Users\Arun\Anaconda3\lib\json_init_.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Arun\Anaconda3\lib\json_init_.py", line 354, in loads
return _default_decoder.decode(s)
File "C:\Users\Arun\Anaconda3\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Arun\Anaconda3\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@takluyver
Copy link
Member

That sounds like a file that should be JSON is not valid JSON - maybe it's been left over as an empty file. We should probably handle that with a nicer error message.

@sina-masoud-ansari
Copy link

This is because it was finding .html files as well. I believe this is fixed in the latest commit ( #4137 ) in notebook\notebookapp.py line 1842 which specifies json files only

@aknrdureegaesr
Copy link

This is because it was finding .html files as well. I believe this is fixed in the latest commit (??? ) in notebook\notebookapp.py line 1842 which specifies json files only

I think you mean commit adcb702. (FWIW: Commits can be referenced in GitHub comments without a leading hashmark.) By using the hashmark the way you do, you are referencing the issue with that number. That issue I consider unrelated.

@arvoelke
Copy link

arvoelke commented Apr 4, 2019

I have the same issue, but with a slightly different error message:

json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

But I cannot find the location of my config file. There are directories ~/miniconda3/envs/loihi/etc/jupyter/nbconfig/ and ~/.jupyter/ but it's not in there.

I can start servers, but I get this message if I try to stop or list them.

@arvoelke
Copy link

arvoelke commented Apr 4, 2019

Found #4283 which was fixed by #4284. Upgrading from notebook==5.6.0 to notebook==5.7.8 fixed the issue for me.

@thangleiter
Copy link

Found #4283 which was fixed by #4284. Upgrading from notebook==5.6.0 to notebook==5.7.8 fixed the issue for me.

Indeed, the upgrade fixes it. Unfortunately, notebook==5.7.4 (where the patch was introduced) is incompatible with Python 3.5 and thus one is stuck with the buggy version on Python 3.5.

@takluyver
Copy link
Member

The 5.7 series should still be supporting 3.5, so if you can see what's making it incompatible, please send a pull request to fix it.

@thangleiter
Copy link

As far as I can tell, there are at least no conda packages of the 5.7 series for 3.5. 5.6.0 is the last to have been built for 3.5.

Of course, if 5.6 is still being updated, I can quickly send a PR since it should only be the one line that needs to be changed.

@takluyver
Copy link
Member

Oh, conda packages. As far as I know, conda has stopped building everything for Python 3.5, and nothing we do in this repo will affect that. You probably need to either build a conda environment with a newer Python, or uninstall the package with conda and install a newer version with pip.

@thangleiter
Copy link

Right, sorry for the confusion about that. Thanks!

@despoisj
Copy link

despoisj commented Jan 7, 2020

I don't know why, but I solved this exact issue by upgrading from python 3.6 to python 3.7 (the other suggested fix didn't work).

@alexchernykh
Copy link

alexchernykh commented Jan 20, 2020

as a workaround you can kill the process by its PID
For example if Jupyter notebook runs on port 8888
sudo lsof -i tcp:8888
kill -9 PID

After that you can restart your notebook and the kernel should not die immediately after it starts.

@Aiiiiii
Copy link

Aiiiiii commented Jan 25, 2020

My python version is 3.7.6 and ipython version is 7.8.0. Same problem and haven't solved yet.

@martinehman
Copy link

martinehman commented Feb 11, 2020

Same issue with Python 3.7.4 (not conda) and notebook==6.0.1 and ipython==7.7.0

@cmdavis4
Copy link

This is because it was finding .html files as well. I believe this is fixed in the latest commit ( #4137 ) in notebook\notebookapp.py line 1842 which specifies json files only

Confirmed that the html files were the issue for me, if you're looking for a quick and dirty fix without changing your python or jupyter versions you can find the directory it's looking in with jupyter --runtime-dir and delete the .html files there.

@mcourteaux
Copy link

To get the token for your notebook; just Ctrl-C the process in the terminal, and it will show the token, and ask you to confirm quitting. Just hit "n" to keep it running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests