beakerx
beakerx copied to clipboard
Errors when trying to use Python autotranslation in JVM kernels
When I try to execute any cell containing %%python in a JVM-based notebook, the following error is thrown and displayed as an output:
py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: Traceback (most recent call last):
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/py4j/clientserver.py", line 581, in _call_proxy
return_value = getattr(self.pool[obj_id], method)(*params)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/beakerx_kernel_autotranslation/jvm_server.py", line 27, in evaluate
self.pm.run_cell(code)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/beakerx_kernel_autotranslation/jvm_kernel_magic.py", line 44, in run_cell
self.kc.execute(code, allow_stdin=True)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/jupyter_client/blocking/client.py", line 20, in _
msg_id = meth(self, *args, **kwargs)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/jupyter_client/client.py", line 607, in execute
self.shell_channel.send(msg)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/jupyter_client/channels.py", line 263, in send
self.session.send(self.socket, msg)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/jupyter_client/session.py", line 853, in send
stream.send_multipart(to_send, copy=copy)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/zmq/_future.py", line 248, in send_multipart
return self._add_send_event('send_multipart', msg=msg, kwargs=kwargs)
File "/opt/conda/envs/beakerx/lib/python3.7/site-packages/zmq/_future.py", line 410, in _add_send_event
f = future or self._Future()
File "/opt/conda/envs/beakerx/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'Thread-5'.
The error happens on installation made either from cloned repos (i.e. like cd beakerx_kernel_groovy/groovy-dist; pip install -r requirements.txt --verbose; beakerx_kernel_groovy install) or from published packages (i.e. conda install -n beakerx -c beakerx beakerx_all).
I also have an old installation laying around made from Github cloned repos on 2020-11-06, where the error doesn't occur.
After trying numerous configurations, I limited the problem to a single package.
The problem occurs in conjunction with version 7 of jupyter_client. When instead forcing the installation of jupyter_client=6.1.12, or adding
- jupyter_client<7
to dependencies in beakerx-dist/configuration.yml, the exception is not raised in the Java notebook with %%python magic.
Unfortunately, I lack the knowledge of Jupyter inner workings to trace the actual bug; The changelog of jupyter_client doesn't give me clue either.