jupyter / jupyter_client

Jupyter protocol client APIs
https://jupyter-client.readthedocs.io
BSD 3-Clause "New" or "Revised" License
385 stars 285 forks source link

Exception 'coroutine' object is not subscriptable #748

Open admanero opened 2 years ago

admanero commented 2 years ago

I am trying to connect to a ipython kernel running on a remote machine (running CentOS 8) in the remote machine I run: ipython kernel

it produces a kernel-*.json file ~/.local/share/jupyter/runtime/kernel-1050883.json which I SCP (secure copy) to the local machine (my notebook running Ubuntu 20.04). I setup SSH tunnels for the ports mentioned in the kernel-1050883.json :

ssh -i ~/.ssh/ -f -N -L 35921:localhost:35921 user@remote ssh -i ~/.ssh/ -f -N -L 37943:localhost:37943 user@remote ssh -i ~/.ssh/ -f -N -L 46279:localhost:46279 user@remote ssh -i ~/.ssh/ -f -N -L 38993:localhost:38993 user@remote ssh -i ~/.ssh/ -f -N -L 52657:localhost:52657 user@remote

After this step I call jupyter console with the --existing option pointing to the kernel json file:

jupyter console --existing ~/.local/share/jupyter/runtime/kernel-1055695.json but after the prompt appears any command I enter I get the error copied bellow ending with the exception in the title of this issue.

Am I doing something wrong? Or there is an issue here? In spyder I can connect an ipython console to the remote machine and it works fine.

Jupyter console 6.4.0

Python 3.8.12 | packaged by conda-forge | (default, Jan 30 2022, 23:42:07) Type 'copyright', 'credits' or 'license' for more information IPython 7.31.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: ls/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/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 "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/asyncio/events.py", line 81, in _run self._context.run(self._callback, *self._args) File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper callback() File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 712, in read_from_input self.key_processor.process_keys() File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys self._process_coroutine.send(key_press) File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process self._call_handler(matches[-1], key_sequence=buffer[:]) File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler handler.call(event) File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call result = self.handler(event) File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/site-packages/jupyterconsole/ptshell.py", line 475, in self.handle_iopub() File "/home/admanero/Workspace/Scripting/anaconda3/lib/python3.8/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...

[1]+ Stopped jupyter console --existing ~/.local/share/jupyter/runtime/kernel-1055695.json (base) (01:43 admanero@ThinkPad-X270 anaconda3) > kill %1

davidbrochart commented 2 years ago

Hi @admanero, I think this is fixed in jupyter_console, but it has not been released.

admanero commented 2 years ago

Thanks David Brochart. Is there a version & schedule when this fix would be out? Do you know? Thanks

Hi @admanero, I think this is fixed in jupyter_console, but it has not been released.

davidbrochart commented 2 years ago

See https://github.com/jupyter/jupyter_console/issues/256#issuecomment-1058580970.