3

For some odd reason, after last night my jupyter kernel wouldn't start so I went ahead and removed it and pip3 installed it and now everytime I run jupyter notebook Im getting the following long stack trace in the termninal

[I 14:59:43.566 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 14:59:43.885 NotebookApp] Serving notebooks from local directory: /home/dmitri/machine_learning/airbusShipDetection
[I 14:59:43.885 NotebookApp] The Jupyter Notebook is running at:
[I 14:59:43.885 NotebookApp] http://localhost:8888/?token=b98d3bd1ec284b81559e0a865c14d6a0932e0725a99d811d
[I 14:59:43.885 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:59:43.885 NotebookApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=b98d3bd1ec284b81559e0a865c14d6a0932e0725a99d811d
[I 14:59:44.624 NotebookApp] Accepting one-time-token-authenticated connection from 127.0.0.1
[I 14:59:48.412 NotebookApp] Kernel started: 15342e49-8fc3-402c-9964-eb8f4e2324c5
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/home/dmitri/.local/lib/python3.5/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 477, in start
    ioloop.IOLoop.instance().start()
  File "/usr/local/lib/python3.5/dist-packages/tornado/platform/asyncio.py", line 132, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 340, in run_forever
    raise RuntimeError('Event loop is running.')
RuntimeError: Event loop is running.
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tornado/stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    self.pre_handler_hook()
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
  File "/usr/lib/python3.5/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events
    self._handle_recv()
  File "/usr/local/lib/python3.5/dist-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv
    self._run_callback(callback, msg)
  File "/usr/local/lib/python3.5/dist-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tornado/stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    self.pre_handler_hook()
  File "/home/dmitri/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
  File "/usr/lib/python3.5/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
[W 15:00:48.619 NotebookApp] Timeout waiting for kernel_info reply from 15342e49-8fc3-402c-9964-eb8f4e2324c5
[I 15:01:49.148 NotebookApp] Saving file at /u-net-model-with-submission.ipynb
^C[I 15:02:46.820 NotebookApp] interrupted
Serving notebooks from local directory: /home/dmitri/machine_learning/airbusShipDetection
1 active kernel
The Jupyter Notebook is running at:

The notebook itself says the kernel is loading, but it never finishes loading.

2 Answers 2

4

I had the same problem after upgrading notebook.

Upgrading tornado and ipykernel fixed it for me.

Sign up to request clarification or add additional context in comments.

Comments

3

If you use the following commands in your terminal, it should work:

pip install tornado==5.1.1

and

pip install -U ipykernel

After rolling back "tornado" and updating "ipykernel" everything worked.

1 Comment

This solution works also for RuntimeError: This event loop is already running

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.