Closed maxecharel closed 2 years ago
After a pip upgrade, I also hit this error Exception 'coroutine' object is not subscriptable
. I tried different things:
but none of them works and my jupyter console is broken.
Any idea?
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
.
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
I got same problem.
Python 3.8.10
Package Version
backcall 0.2.0 debugpy 1.4.1 decorator 5.0.9 entrypoints 0.3 ipykernel 6.2.0 ipython 7.26.0 ipython-genutils 0.2.0 jedi 0.18.0 jupyter-client 6.1.13 jupyter-console 6.4.0 jupyter-core 4.7.1 matplotlib-inline 0.1.2 nest-asyncio 1.5.1 parso 0.8.2 pexpect 4.8.0 pickleshare 0.7.5 pip 21.2.4 prompt-toolkit 3.0.20 ptyprocess 0.7.0 Pygments 2.10.0 python-dateutil 2.8.2 pyzmq 22.2.1 setuptools 45.2.0 six 1.16.0 tornado 6.1 traitlets 5.0.5 wcwidth 0.2.5 wheel 0.34.2
Jupyter console 6.4.0
Python 3.8.10 (default, Jun 2 2021, 10:49:15) Type 'copyright', 'credits' or 'license' for more information IPython 7.26.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: /usr/local/lib/python3.8/dist-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/lib/python3.8/asyncio/events.py", line 81, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.8/dist-packages/prompt_toolkit/input/vt100.py", line 168, in callback_wrapper callback() File "/usr/local/lib/python3.8/dist-packages/prompt_toolkit/application/application.py", line 691, in read_from_input self.key_processor.process_keys() File "/usr/local/lib/python3.8/dist-packages/prompt_toolkit/key_binding/key_processor.py", line 274, in process_keys self._process_coroutine.send(key_press) File "/usr/local/lib/python3.8/dist-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.8/dist-packages/prompt_toolkit/key_binding/key_processor.py", line 329, in _call_handler handler.call(event) File "/usr/local/lib/python3.8/dist-packages/prompt_toolkit/key_binding/key_bindings.py", line 102, in call result = self.handler(event) File "/usr/local/lib/python3.8/dist-packages/jupyterconsole/ptshell.py", line 475, in self.handle_iopub() File "/usr/local/lib/python3.8/dist-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...
On python3.7, downgrading from jupyter-client 7.0.1 to 6.1.12 worked for me.
This fixed problem for me too -- ran into it when trying to startup jupyter console
using the elpy. Haven't done this in a while, so don't know when it started.
It would be handy to know the underlying cause or if there's a long term solution to determine if I can consider emacs is viable jupyter interface for a project..
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.
For completeness (can't remember if I gave details), but I'm running Mint 20.1 (relatively fresh install) using stock python (not anaconda). Downgrading via pip filxed for me as well. Also happy to help if I can..
On Wed, Sep 22, 2021 at 2:59 AM muhark @.***> wrote:
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.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jupyter/jupyter_console/issues/241#issuecomment-924726537, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUE7KL3NSVU57ENLAPVJJDUDGLHXANCNFSM43F7KMPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
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...
Same issue on ubuntu 20.
In case further reports are welcome and/or useful, I've had this too for a while on Python 3.7.2 without conda on macOS 11.5.2. Jupyter Lab works fine, but the console gives
🛰 ~ ▶ jupyter console
Jupyter console 6.4.0
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pandas as diplomacy
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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 "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
callback()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
self.key_processor.process_keys()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
self._process_coroutine.send(key_press)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
handler.call(event)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
result = self.handler(event)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 475, in _
self.handle_iopub()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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
🛰 ~ ▶
Some async stuff about the ZMQ messaging something something apparently.
It's talking about tracemalloc, so
🛰 ~ ▶ PYTHONTRACEMALLOC=1 jupyter console
Jupyter console 6.4.0
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pandas as diplomacy
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
while self.client.iopub_channel.msg_ready():
Object allocated at (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_console/ptshell.py", lineno 852
while self.client.iopub_channel.msg_ready():
Unhandled exception in event loop:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
callback()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
self.key_processor.process_keys()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
self._process_coroutine.send(key_press)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
handler.call(event)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
result = self.handler(event)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 475, in _
self.handle_iopub()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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
Object allocated at (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jupyter_console/ptshell.py", lineno 853
sub_msg = self.client.iopub_channel.get_msg()
🛰 ~ ▶
Does that make us any wiser by bring us to https://github.com/jupyter/jupyter_console/blob/64f1695d7efbc60d29b98e652b3d71fb9227eb07/jupyter_console/ptshell.py#L852
Isn't this fixed by https://github.com/jupyter/jupyter_console/pull/244?
Isn't this fixed by #244?
It appears it is.
I had another issue a few days ago with my OSX (intel) with this. I had to downgrade my Python to from 3.10 to something below for jup_console to work.
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
Reproduced macOS 12.2.1 (apple M1)
Jupyter console 6.4.0
Python 3.9.10 | packaged by conda-forge | (main, Feb 1 2022, 21:27:43)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.
/opt/homebrew/Caskroom/miniforge/base/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 "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
callback()
File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 712, in read_from_input
self.key_processor.process_keys()
File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
self._process_coroutine.send(key_press)
File "/opt/homebrew/Caskroom/miniforge/base/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 "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
handler.call(event)
File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
result = self.handler(event)
File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
self.handle_iopub()
File "/opt/homebrew/Caskroom/miniforge/base/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
conda list
Upgrading to jupyter-console 6.4.3 should fix the issue.
Yeah it's working for me now on macOS. Stellar, thank you.
Hello. When I run Jupyter console on Ubuntu 18.04, I get:
So far so good. But what the command I then type, I get:
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?