jupyter_client: Runtime error raised by kernel dying in wait_for_ready
I’ve seen this error with conda builds on RTD several times. The latest was a recent build of the notebook docs.
Documenting here if not related to random kernel deaths and more relevant here (or nbconvert) than notebook issues.
Error occurs:
- after converting several Sphinx documents
- when preprocessing a notebook file with nbconvert
- in jupyter_client
wait_for_ready
Relevant lines from Traceback
nbconvert/preprocessors/execute.py", line 141, in preprocess
jupyter_client/manager.py", line 433, in start_new_kernel
kc.wait_for_ready(timeout=startup_timeout)
jupyter_client/blocking/client.py", line 59, in wait_for_ready
raise RuntimeError('Kernel died before replying to kernel_info')
RuntimeError: Kernel died before replying to kernel_info
Full Traceback
reading sources... [ 22%] examples/Notebook/Connecting with the Qt Console
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/cmdline.py", line 244, in main
app.build(opts.force_all, filenames)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/application.py", line 267, in build
self.builder.build_update()
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/builders/__init__.py", line 251, in build_update
'out of date' % len(to_build))
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/builders/__init__.py", line 265, in build
self.doctreedir, self.app))
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/environment.py", line 547, in update
self._read_serial(docnames, app)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/environment.py", line 567, in _read_serial
self.read_doc(docname, app)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/environment.py", line 720, in read_doc
pub.publish()
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/docutils/core.py", line 217, in publish
self.settings)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/sphinx/io.py", line 46, in read
self.parse()
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/docutils/readers/__init__.py", line 78, in parse
self.parser.parse(self.input, document)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/nbsphinx.py", line 406, in parse
rststring, resources = exporter.from_notebook_node(nb, resources)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/nbsphinx.py", line 360, in from_notebook_node
nb, resources = pp.preprocess(nb, resources)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/nbconvert/preprocessors/execute.py", line 141, in preprocess
cwd=path)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/jupyter_client/manager.py", line 433, in start_new_kernel
kc.wait_for_ready(timeout=startup_timeout)
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/jupyter_client/blocking/client.py", line 59, in wait_for_ready
raise RuntimeError('Kernel died before replying to kernel_info')
RuntimeError: Kernel died before replying to kernel_info
Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/jupyter-notebook/conda/latest/lib/python3.5/site-packages/jupyter_client/blocking/client.py", line 59, in wait_for_ready
raise RuntimeError('Kernel died before replying to kernel_info')
RuntimeError: Kernel died before replying to kernel_info
The full traceback has been saved in /tmp/sphinx-err-u6hd8ohp.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 30 (14 by maintainers)
Commits related to this issue
- Update Dockerfile wrap jupyter nbconvert in sh -c (https://github.com/jupyter/jupyter_client/issues/154) — committed to floriangeigl/docker-DataScience by floriangeigl 5 years ago
We were getting this error on
papermill
when we tried running a tests in a AWS LambdaWe were getting this error on
papermill
when we tried running the tests in a virtual environment usingvenv
. The only thing that solved it was installingipykernel
then runningpython -m ipykernel install --user
before executing a notebookHi @mlucool - you’re right, this is a race condition. Ideally, the kernel would create/bind to the ports and communicate back to the launching application (jupyter_client), which is what the kernel handshaking pattern proposes. Another possibility would be to write a kernel provisioner that does what’s necessary (kernel handshake?) since the connection info now comes from there. Moving port management kernel-side seems like a good goal.
I believe I understand this now. This code finds free ports and then writes the set of ports to the connection file so that a kernel knows where to join. This is a race condition as the ports can be used up before the kernel tries to bind them. I’m not sure of a good way to fix this.
It looks like I’m still using versions older than those. I’ll update and see if I still see the issue. Thanks for the reply. On Tue, Jul 11, 2017 at 3:15 PM Carol Willing notifications@github.com wrote:
Hi @desilinguist,
I thought that the latest stable versions of jupyter_client and nbconvert had resolved this issue. However, as you are still seeing intermittent issues, there may be a timing issue particularly if it is happening in the CI builds. Can you share what versions you are running? Also if you have a CI error log that would be helpful too. Thanks!
ExecutePreprocessor.iopub_timeout : Int
to be configurable by the user. The default is 4s for timeout. You could try configuring it to be larger and see if that helps when running CI too.cc/ @minrk @mpacer
Is there any resolution for this issue yet? I also intermittently encounter this error in the CI builds for my python application that uses
nbconvert.exporters.HTMLExporter
to programmatically render a jupyter notebook to HTML.@jdanbrown thank you! that worked (when I got around to testing it)