jupyter_console: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited

Hello. When I run Jupyter console on Ubuntu 18.04, I get:

Jupyter console 6.1.0

Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 

So far so good. But what the command I then type, I get:

/usr/local/lib/python3.6/dist-packages/jupyter_console/ptshell.py:718: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():

Unhandled exception in event loop:
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/home/mp/.local/lib/python3.6/site-packages/prompt_toolkit/input/vt100.py", line 168, in callback_wrapper
    callback()
  File "/home/mp/.local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 691, in read_from_input
    self.key_processor.process_keys()
  File "/home/mp/.local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 274, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/mp/.local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/home/mp/.local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 329, in _call_handler
    handler.call(event)
  File "/home/mp/.local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 102, in call
    result = self.handler(event)
  File "/usr/local/lib/python3.6/dist-packages/jupyter_console/ptshell.py", line 377, in _
    self.handle_iopub()
  File "/usr/local/lib/python3.6/dist-packages/jupyter_console/ptshell.py", line 720, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

Note that this is also the case with another kernel, and that Jupyter lab works. The problem seems to come from Jupyter console. Any idea how to handle this?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 21
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

After lots of trial-and-errors with different versions of pyzmq, prompt-toolkit, jupyter_client, jupyter_console, I’ve recovered jupyter-console. That was indeed a dependency hell problem.

Unclear what the actual fix is. Maybe downgrading jupyter-client 6.2.0 to jupyter-client 6.1.12.

On python3.7, downgrading from jupyter-client 7.0.1 to 6.1.12 worked for me.

Getting the same issue in a fresh install of Ubuntu 21.04, python 3.9.5, using Anaconda as installer. Downgrading to 6.1.12 also worked for me (conda install jupyter_client=6.1). Let me know if there’s any way I can help address this issue.

I have a similar issue; a Void Linux contributor has PR’ed an omnipus jupyter update and running jupyter console triggers the RuntimeWarning about ZMQSocketChannel.msg_ready not being awaited. Downgrading only python3-jupyter_client to 6.1.0_2 (the version currently packaged in Void) resolves the issue.

PyZMQ is installed via the python3-pyzmq-22.1.0_1 package in Void, although an earlier version also triggered the issue.

Edit: Void update PR: https://github.com/void-linux/void-packages/pull/30873

Same issue here! Mac OS 11.6. Homebrew Python 3.10.0 and 3.9.7, and Perl 5.34.0. Trying to use IPerl kernel. Fixed by downgrading jupyter_client to 6.1.12 via pip3 install -Iv jupyter_client==6.1.12.

3.10.0:

~ % jupyter kernelspec list
Available kernels:
 iperl      /Users/iremizov/Library/Jupyter/kernels/iperl
 python3    /usr/local/share/jupyter/kernels/python3
~ % iperl
Jupyter console 6.4.0

IPerl!Traceback (most recent call last):
 File "/usr/local/bin/jupyter-console", line 8, in <module>
   sys.exit(main())
 File "/usr/local/lib/python3.10/site-packages/jupyter_core/application.py", line 264, in launch_instance
   return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
 File "/usr/local/lib/python3.10/site-packages/traitlets/config/application.py", line 846, in launch_instance
   app.start()
 File "/usr/local/lib/python3.10/site-packages/jupyter_console/app.py", line 148, in start
   self.shell.mainloop()
 File "/usr/local/lib/python3.10/site-packages/jupyter_console/ptshell.py", line 664, in mainloop
   main_task = asyncio.wait(tasks, loop=loop, return_when=asyncio.FIRST_COMPLETED)
TypeError: wait() got an unexpected keyword argument 'loop'
sys:1: RuntimeWarning: coroutine 'ZMQTerminalInteractiveShell.interact' was never awaited

3.9.7:

~ % iperl
Jupyter console 6.4.0

IPerl!
In [1]: q/usr/local/lib/python3.9/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 691, in read_from_input
    self.key_processor.process_keys()
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 274, in process_keys
    self._process_coroutine.send(key_press)
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 329, in _call_handler
    handler.call(event)
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 102, in call
    result = self.handler(event)
  File "/usr/local/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/usr/local/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

Yeah it’s working for me now on macOS. Stellar, thank you.

Reproduced on MacOs python 3.9.9 iTerm2 Build 3.4.14

python3 -m venv env
source env/bin/activate
(env) pip install jupyter
(env) jupyter console
jupyter console
Jupyter console 6.4.0

Python 3.9.9 (main, Nov 21 2021, 03:23:42)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: ?
/Users/user/project/env/lib/python3.9/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/user/project/env/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
    callback()
  File "/Users/user/project/env/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 704, in read_from_input
    self.key_processor.process_keys()
  File "/Users/user/project/env/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
    self._process_coroutine.send(key_press)
  File "/Users/user/project/env/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/Users/user/project/env/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/Users/user/project/env/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
  File "/Users/user/project/env/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/Users/user/project/env/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...
In [1]:
Do you really want to exit ([y]/n)? y
Shutting down kernel
sys:1: RuntimeWarning: coroutine 'ZMQSocketChannel.get_msg' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback