Cannot run qtconsole with existing kernel in jupyter-client 7
ishigoya opened this issue ยท 4 comments
ishigoya commented
Issue description
Unable to run qtconsole with existing kernel
Steps to reproduce
- launch a kernel
$ jupyter notebook
select a new Python 3 notebook
- run qtconsole, connecting to existing kernel
$ jupyter qtconsole --existing
The QtConsole window appears and is blank. The error output is shown below.
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/.local/lib/python3.9/site-packages/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/.local/lib/python3.9/site-packages/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(20, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(20, 1)>
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/user/.local/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
handler_func(fileobj, events)
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/.local/lib/python3.9/site-packages/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/.local/lib/python3.9/site-packages/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/.local/lib/python3.9/site-packages/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(18, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(18, 1)>
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/user/.local/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
handler_func(fileobj, events)
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/.local/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/.local/lib/python3.9/site-packages/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
/usr/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/utils.py:8: RuntimeWarning: coroutine 'get_msg' was never awaited
from .tags import Tag, parse_tag
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py:3270: RuntimeWarning: coroutine 'get_msg' was never awaited
if all(isinstance(expr, basestring) for expr in exprs):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Environment
_$ pip list --user | grep jupyter
jupyter 1.0.0
jupyter-client 7.1.1
jupyter-console 6.4.0
jupyter-core 4.9.1
jupyterlab-pygments 0.1.2
jupyterlab-widgets 1.0.2
_$ pip list --user | grep ipy
ipykernel 6.7.0
ipython 8.0.0
ipython-genutils 0.2.0
ipywidgets 7.6.5
_$ pip list --user | grep zmq
pyzmq 22.3.0
_$ python --version
Python 3.9.9
_$ cat ~/.jupyter/jupyter_qtconsole_config.py
c = get_config()
c.ConsoleWidget.scrollbar_visibility = False
c.ConsoleWidget.font_family = "Inconsolata"
c.ConsoleWidget.font_size = 14
c.JupyterQtConsoleApp.hide_menubar = True
c.JupyterWidget.include_other_output = True
ishigoya commented
I repeated the above with the current main
branch of python_console, qtconsole, and jupyter_client, and got the same issue with a similar error message (below)
Error
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/jupyter-test/jupyter_client/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/jupyter-test/jupyter_client/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(20, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(20, 1)>
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/user/jupyter-test/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
handler_func(fileobj, events)
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/jupyter-test/jupyter_client/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/jupyter-test/jupyter_client/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/jupyter-test/jupyter_client/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(18, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(18, 1)>
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/user/jupyter-test/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
handler_func(fileobj, events)
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 452, in _handle_events
self._handle_recv()
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 481, in _handle_recv
self._run_callback(callback, msg)
File "/home/user/jupyter-test/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "/home/user/jupyter-test/jupyter_client/jupyter_client/threaded.py", line 121, in _handle_recv
msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
/usr/lib/python3.9/sre_parse.py:499: RuntimeWarning: coroutine 'get_msg' was never awaited
sourceget = source.get
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
ishigoya commented
I've confirmed that this works with jupyter-client
version 6.1.12
astromancer commented
The ability to connect to an existing kernel is critical to my workflow. Hope this gets a fix soon.
bellecp commented
I am running into the same issue as well. One quick fix is to
- launch the qtconsole (e.g.,
$ jupyter qtconsole &
) which may open an undesired new kernel - file -> new tab with existing kernel. Then, pick the desired kernel file
- close the tab of the undesired kernel opened in step 1