RuntimeError: Cannot run the event loop while another loop is running
xxr0ss opened this issue · 5 comments
Running in IDA 7.5.
Not able to start an ipyida window. when trying to open one in IDA, the output window:
Task was destroyed but it is pending!
task: <Task pending name='Task-2' coro=<Kernel.dispatch_queue() done, defined at D:\Python\Python39\lib\site-packages\ipykernel\kernelbase.py:447> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000014A16917520>()]> cb=[IOLoop.add_future.<locals>.<lambda>() at D:\Python\Python39\lib\site-packages\tornado\ioloop.py:688]>
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "D:\Python\Python39\lib\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 "D:\Python\Python39\Lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "D:\Python\Python39\Lib\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 "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 448, in _handle_events
self._handle_recv()
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 477, in _handle_recv
self._run_callback(callback, msg)
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "D:\Python\Python39\lib\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 "D:\Python\Python39\Lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "D:\Python\Python39\Lib\asyncio\base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
Exception in callback BaseAsyncIOLoop._handle_events(2496, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(2496, 1)>
Traceback (most recent call last):
File "D:\Python\Python39\Lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "D:\Python\Python39\lib\site-packages\tornado\platform\asyncio.py", line 189, in _handle_events
handler_func(fileobj, events)
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 448, in _handle_events
self._handle_recv()
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 477, in _handle_recv
self._run_callback(callback, msg)
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "D:\Python\Python39\lib\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 "D:\Python\Python39\Lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "D:\Python\Python39\Lib\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 "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "D:\Python\Python39\lib\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 "D:\Python\Python39\Lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "D:\Python\Python39\Lib\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 "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 448, in _handle_events
self._handle_recv()
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 477, in _handle_recv
self._run_callback(callback, msg)
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "D:\Python\Python39\lib\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 "D:\Python\Python39\Lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "D:\Python\Python39\Lib\asyncio\base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
Exception in callback BaseAsyncIOLoop._handle_events(2460, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(2460, 1)>
Traceback (most recent call last):
File "D:\Python\Python39\Lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "D:\Python\Python39\lib\site-packages\tornado\platform\asyncio.py", line 189, in _handle_events
handler_func(fileobj, events)
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 448, in _handle_events
self._handle_recv()
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 477, in _handle_recv
self._run_callback(callback, msg)
File "D:\Python\Python39\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
callback(*args, **kwargs)
File "D:\Python\Python39\lib\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 "D:\Python\Python39\Lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "D:\Python\Python39\Lib\asyncio\base_events.py", line 580, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
I've tried reinstalling ipyida, ipykernel, pyzmq and so on, but it still doesn't work. 😣
humm, I'm able to reproduce using Python 3.8 and IDA 7.6.
Some updated dependency may have broken something. I'll downgrade one by one to find the guilty one.
ok I found it, something broke when using jupyter_client >= 7
.
While I investigate the root cause of the incompatibility, you can downgrade jupyter_client
using pip3 install -U 'jupyter_client<7'
.
Maybe jupyter_client
is not the only reason. I was using jupyter-client 6.2.0
and got the errors. And I just tried python3.7 /python3.9 + jupyter-client7.0.1/ jupyter-client6.2.0
and all get the same error.
jupyter-client
6.2.0 was yanked (not sure why, see https://pypi.org/project/jupyter-client/#history)
Can you try with 6.1.12?
OHHHHHH 6.1.12 works! 🥳 Thanks! It was really a pain in the ass.