jupyter notebook stop is failing, leaving the server running and forcing it to be manually killed. I observe the following output:
$ jupyter notebook stop
Shutting down server on port 8888 ...
[W 16:27:53.830 NotebookApp] 403 POST /api/shutdown (127.0.0.1): '_xsrf' argument missing from POST
[W 16:27:53.858 NotebookApp] 403 POST /api/shutdown (127.0.0.1) 28.38ms referer=None
Traceback (most recent call last):
File "/home/xxxx/anaconda3/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1758, in start
super(NotebookApp, self).start()
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 456, in start
if not self.shutdown_server(server):
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 447, in shutdown_server
return shutdown_server(server, log=self.log)
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 407, in shutdown_server
HTTPClient().fetch(req)
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/tornado/httpclient.py", line 119, in fetch
self._async_client.fetch, request, **kwargs))
File "/home/xxxx/anaconda3/lib/python3.7/site-packages/tornado/ioloop.py", line 576, in run_sync
return future_cell[0].result()
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden
The only modifications I've made to jupyter_notebook_config.py are:
c.NotebookApp.ip = '127.0.0.1' # 'localhost' errors with "OSError: [Errno 99] Cannot assign requested address".
c.NotebookApp.open_browser = False # I'm connecting via ssh port forwarding.
My jupyter_notebook_config.json contains a NotebookApp: password that was set up when first connecting (via JupyterLab).
I'm in the base environment of a conda install on Linux.
This configuration used to work fine, i.e. jupyter notebook stop shut down the server without error.
Same issue here on Ubuntu Server 18.04, except it's accessible from '0.0.0.0.'
jupyter notebook stop 8787
Shutting down server on port 8787 ...
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/notebook/notebookapp.py", line 1758, in start
super(NotebookApp, self).start()
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/usr/local/lib/python3.6/dist-packages/notebook/notebookapp.py", line 456, in start
if not self.shutdown_server(server):
File "/usr/local/lib/python3.6/dist-packages/notebook/notebookapp.py", line 447, in shutdown_server
return shutdown_server(server, log=self.log)
File "/usr/local/lib/python3.6/dist-packages/notebook/notebookapp.py", line 407, in shutdown_server
HTTPClient().fetch(req)
File "/usr/local/lib/python3.6/dist-packages/tornado/httpclient.py", line 119, in fetch
self._async_client.fetch, request, **kwargs))
File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 576, in run_sync
return future_cell[0].result()
tornado.simple_httpclient.HTTPTimeoutError: Timeout during request
I have the same problem
Traceback (most recent call last):
File "/home/xiaoyu/miniconda3/envs/deep_mol/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/notebook/notebookapp.py", line 1698, in start
super(NotebookApp, self).start()
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/notebook/notebookapp.py", line 455, in start
if not self.shutdown_server(server):
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/notebook/notebookapp.py", line 446, in shutdown_server
return shutdown_server(server, log=self.log)
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/notebook/notebookapp.py", line 406, in shutdown_server
HTTPClient().fetch(req)
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/tornado/httpclient.py", line 119, in fetch
self._async_client.fetch, request, **kwargs))
File "/home/xiaoyu/miniconda3/envs/deep_mol/lib/python3.6/site-packages/tornado/ioloop.py", line 576, in run_sync
return future_cell[0].result()
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden
I have the same problem running on CentOS Linux release 7.6.1810 (Core)
(base) [root@test-server runtime]# jupyter notebook stop 80
Shutting down server on port 80 ...
Traceback (most recent call last):
File "/root/anaconda3/bin/jupyter-notebook", line 11, in
sys.exit(main())
File "/root/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/root/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1760, in start
super(NotebookApp, self).start()
File "/root/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/root/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 456, in start
if not self.shutdown_server(server):
File "/root/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 447, in shutdown_server
return shutdown_server(server, log=self.log)
File "/root/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 407, in shutdown_server
HTTPClient().fetch(req)
File "/root/anaconda3/lib/python3.7/site-packages/tornado/httpclient.py", line 133, in fetch
functools.partial(self._async_client.fetch, request, *kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/tornado/ioloop.py", line 532, in run_sync
return future_cell[0].result()
tornado.simple_httpclient.HTTPTimeoutError: Timeout during request
Got this problem trying to stop notebook running on port 8086
jupyter notebook stop 8086
Shutting down server on port 8086 ...
[W 19:06:07.591 NotebookApp] 403 POST /api/shutdown (127.0.0.1): '_xsrf' argument missing from POST
[W 19:06:07.616 NotebookApp] 403 POST /api/shutdown (127.0.0.1) 25.88ms referer=None
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/jupyter_core/application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 1910, in start
super(NotebookApp, self).start()
File "/usr/local/lib/python3.5/dist-packages/jupyter_core/application.py", line 257, in start
self.subapp.start()
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 466, in start
if not self.shutdown_server(server):
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 457, in shutdown_server
return shutdown_server(server, log=self.log)
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 417, in shutdown_server
HTTPClient().fetch(req)
File "/usr/local/lib/python3.5/dist-packages/tornado/httpclient.py", line 119, in fetch
self._async_client.fetch, request, *kwargs))
File "/usr/local/lib/python3.5/dist-packages/tornado/ioloop.py", line 576, in run_sync
return future_cell[0].result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden
Got this problem trying to stop notebook running on port 8086
jupyter notebook stop 8086
Shutting down server on port 8086 ...
[W 19:06:07.591 NotebookApp] 403 POST /api/shutdown (127.0.0.1): '_xsrf' argument missing from POST
[W 19:06:07.616 NotebookApp] 403 POST /api/shutdown (127.0.0.1) 25.88ms referer=None
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/jupyter_core/application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 1910, in start
super(NotebookApp, self).start()
File "/usr/local/lib/python3.5/dist-packages/jupyter_core/application.py", line 257, in start
self.subapp.start()
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 466, in start
if not self.shutdown_server(server):
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 457, in shutdown_server
return shutdown_server(server, log=self.log)
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 417, in shutdown_server
HTTPClient().fetch(req)
File "/usr/local/lib/python3.5/dist-packages/tornado/httpclient.py", line 119, in fetch
self._async_client.fetch, request, *kwargs))
File "/usr/local/lib/python3.5/dist-packages/tornado/ioloop.py", line 576, in run_sync
return future_cell[0].result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden
Was using Ubuntu 16.04 and used the command:
pkill jupyter
that worked killing all the running notebooks on different ports
A server started with c.NotebookApp.password defined will disable the auxiliary token authentication. As such, when jupyter notebook stop blithely sends an empty token, the tornado server will try verifying with XSRF and fail with
403 POST /api/shutdown (127.0.0.1): '_xsrf' argument missing from POST.
One could indiscriminately set c.NotebookApp.disable_check_xsrf=true but then anybody on the internet could shutdown your jupyter instance with merely a POST request saying "api/shutdown".
Most helpful comment
Was using Ubuntu 16.04 and used the command:
pkill jupyterthat worked killing all the running notebooks on different ports