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

ERROR:tornado.general:Uncaught exception in ZMQStream callback #6783

Closed
adityamagarde opened this issue Mar 17, 2018 · 17 comments
Closed

ERROR:tornado.general:Uncaught exception in ZMQStream callback #6783

adityamagarde opened this issue Mar 17, 2018 · 17 comments

Comments

@adityamagarde
Copy link

Description

What steps will reproduce the problem?

  1. Open spyder.
  2. Tries to connect to the kernel.
  3. Shows the error.

What is the expected output? What do you see instead?

An error ocurred while starting the kernel
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 276, in null_wrapper
return fn(*args, **kwargs)
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
self.pre_handler_hook()
File "/home/adityamagarde/.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 276, in null_wrapper
return fn(*args, **kwargs)
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
self.pre_handler_hook()
File "/home/adityamagarde/.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.application:Exception in callback functools.partial(.null_wrapper at 0x7f95db138f28>)
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist‑packages/tornado/ioloop.py", line 760, in _run_callback
ret = callback()
File "/usr/local/lib/python3.5/dist‑packages/tornado/stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.5/dist‑packages/zmq/eventloop/zmqstream.py", line 536, in
self.io_loop.add_callback(lambda : self._handle_events(self.socket, 0))
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 276, in null_wrapper
return fn(*args, **kwargs)
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
self.pre_handler_hook()
File "/home/adityamagarde/.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
Traceback (most recent call last):
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/spyder/utils/ipython/start_kernel.py", line 241, in
main()
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/spyder/utils/ipython/start_kernel.py", line 237, in main
kernel.start()
File "/home/adityamagarde/.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 112, 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.
Traceback (most recent call last):
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/spyder/utils/ipython/start_kernel.py", line 241, in
main()
File "/home/adityamagarde/.local/lib/python3.5/site‑packages/spyder/utils/ipython/start_kernel.py", line 237, in main
kernel.start()
File "/home/adityamagarde/.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 112, 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.

Please provide any additional information below
I recently installed jupyter. Even that isn't working I guess.

Version and main components

  • Spyder Version: 3.2.3
  • Python Version: 3.5.2
  • Qt Versions: 4.8.7, PyQt4 (API v2) 4.11.4 on Linux

Dependencies

pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.17.1 (OK)
numpy >=1.7      :  1.13.3 (OK)
sphinx >=0.6.6   :  1.6.4 (OK)
rope >=0.9.4     :  0.10.7 (OK)
jedi >=0.9.0     :  0.11.0 (OK)
psutil >=0.3     :  5.3.1 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
sympy >=0.7.3    :  None (NOK)
cython >=0.21    :  None (NOK)
qtconsole >=4.2.0:  4.3.1 (OK)
IPython >=4.0    :  6.2.1 (OK)
pylint >=0.25    :  1.7.4 (OK)

@adityamagarde
Copy link
Author

I think I resolved the issue by downgrading the tornado version.

@CAM-Gerlach
Copy link
Member

For the record, conda install tornado=4.5.3 should do the trick. Probably related to #6627 and its brethren.

@Tagar
Copy link

Tagar commented May 26, 2018

This seems to be a root cause for https://issues.apache.org/jira/browse/ZEPPELIN-3505

@xiaokunx
Copy link

xiaokunx commented Aug 9, 2018

downgrading tornado to 4.5.3 does not solve the problem, upgrading ipykernel from 4.6.1 to 4.8.2 solve the problem for me.

@Qberto
Copy link

Qberto commented Aug 14, 2018

Like @xiaokunx, downgrading tornado to 4.5.3 did not resolve the issue for me, while upgrading ipykernel solved the problem. conda upgrade ipykernel should do the trick.

@PistachioGuoguo
Copy link

conda upgrade ipykernel did help! But for Chinese using Tsinghua mirror will first have to conda config --remove-key channels to go back to default

@femiaiyeku
Copy link

Upgrading ipykernel worked for me
conda upgrade ipykernel

1 similar comment
@meTchaikovsky
Copy link

Upgrading ipykernel worked for me
conda upgrade ipykernel

@mfschmidt
Copy link

Upgrading ipykernel worked for me, too.

pip install --upgrade ipykernel

@ccordoba12
Copy link
Member

If you're using Anaconda, this needs to be

conda update ipykernel

@mullachv
Copy link

These were my versions, when I encountered the error:

$ conda list ipyker
# packages in environment at /anaconda/envs/dl3.6:
#
# Name                    Version                   Build  Channel
ipykernel                 4.5.2                    py36_0  
(dl3.6) $ 
(dl3.6) $ conda list tornado
# packages in environment at /anaconda/envs/dl3.6:
#
# Name                    Version                   Build  Channel
sockjs-tornado            1.0.3                    py36_0  
tornado                   5.1.1            py36h1de35cc_0  
(dl3.6) $ 
(dl3.6) $ conda list jupyter
# packages in environment at /anaconda/envs/dl3.6:
#
# Name                    Version                   Build  Channel
jupyter                   1.0.0                    py36_4  
jupyter_client            5.2.4                    py36_0  
jupyter_console           5.0.0                    py36_0  
jupyter_core              4.2.1                    py36_0  

What worked for me are to update ipykernel and then install tornado 4.5.3:

$conda update ipykernel
$conda install tornado=4.5.3

ipykernel is now 5.1.0 and tornado is 4.5.3, and my jupyter notebook works alright.

@xiaozhang8tuo
Copy link

THANKS

@okekec
Copy link

okekec commented Jun 4, 2019

@mullachv Thank you for the detailed explanation, your code worked for me. I checked my versions first before upgrading both ipykernel and tornado.

@sliatecinos
Copy link

sliatecinos commented Feb 9, 2020

Upgrading ipykernel in Anaconda worked for me, too:

conda update ipykernel

But the Spyder stopped worked ...

(base) C:\Users\sliatecinos>spyder
Traceback (most recent call last):
  File "C:\Users\sliatecinos\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3718, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\sliatecinos\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3559, in run_spyder
    main.setup()
  File "C:\Users\sliatecinos\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 1010, in setup
    from spyder.plugins.ipythonconsole.plugin import IPythonConsole
  File "C:\Users\sliatecinos\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\plugin.py", line 52, in <module>
    from spyder.plugins.ipythonconsole.widgets import ClientWidget
  File "C:\Users\sliatecinos\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\__init__.py", line 16, in <module>
    from .debugging import DebuggingWidget
  File "C:\Users\sliatecinos\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\debugging.py", line 22, in <module>
    from IPython.core.inputtransformer2 import TransformerManager
ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'

So I needed to upgrade IPython:

conda upgrade ipython

@jpthirumalai
Copy link

pip install --upgrade ipykernel
this worked, and brought up the "jupyter notebook"

@CAM-Gerlach
Copy link
Member

@jpthirumalai If that worked, then your Spyder installation was likely contaminated with pip installed packages (assuming you installed it via Anaconda, as we recommend, and not pip in the first place) and things are likely to break again down the line. While Spyder itself supports installation via pip, if you run into machine-specific problems there isn't much we can do to help you with that other than recommending Anaconda, which avoids most of them. Also, I'm not sure why Jupyter Notebook has anything to do with this, unless you are using the spyder-notebook plugin for Spyder, since this is the Spyder repository not Jupyter.

Furthermore, if others try the same, they are likely to break their installs as well. Ergo, @ccordoba12 will likely want to hide the above comment, and you might want to make a final comment authoritatively stating the correct solution and then lock the thread, since the problem is resolved.

@1dAnderson
Copy link

downgrading tornado to 4.5.3 does not solve the problem, upgrading ipykernel from 4.6.1 to 4.8.2 solve the problem for me.

brilliant! bro

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

No branches or pull requests