ipykernel
ipykernel copied to clipboard
Error when upgrading to ipykernel 6 when using sphinx and jupyter-sphinx
After upgrading ipykernel to version 6 (issue also present in 6.1.0) in the documentation building system for https://github.com/pharmpy/pharmpy we encounter the error below. We are using the https://github.com/jupyter/jupyter-sphinx extension to sphinx to generate parts of the documentation. Reverting to ipykernel 5.5.5 makes the documentation build properly again. The context of the error can be found here: https://github.com/pharmpy/pharmpy/pull/270/checks?check_run_id=3317828667
I would love to give a proper reproducible example, but I am unsure of how to do it. Pointers would be welcome. Perhaps sphinx is doing some parallelization that is incompatible with the latest ipykernel.
[IPKernelApp] ERROR | Exception in control handler:
Traceback (most recent call last):
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 280, in process_control
await result
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 784, in shutdown_request
content = self.do_shutdown(parent['content']['restart'])
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/ipykernel/ipkernel.py", line 496, in do_shutdown
self.shell.exit_now = True
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/traitlets/traitlets.py", line 604, in __set__
self.set(obj, value)
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/traitlets/traitlets.py", line 593, in set
obj._notify_trait(self.name, old_value, new_value)
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/traitlets/traitlets.py", line 1217, in _notify_trait
self.notify_change(Bunch(
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/traitlets/traitlets.py", line 1227, in notify_change
return self._notify_observers(change)
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/traitlets/traitlets.py", line 1264, in _notify_observers
c(event)
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/ipykernel/zmqshell.py", line 468, in _update_exit_now
loop.call_later(0.1, loop.stop)
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/tornado/ioloop.py", line 600, in call_later
return self.call_at(self.time() + delay, callback, *args, **kwargs)
File "/home/runner/work/pharmpy/pharmpy/.tox/docs/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 212, in call_at
return self.asyncio_loop.call_later(
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/asyncio/base_events.py", line 714, in call_later
timer = self.call_at(self.time() + delay, callback, *args,
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/asyncio/base_events.py", line 727, in call_at
self._check_thread()
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/asyncio/base_events.py", line 785, in _check_thread
raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one