question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeadKernelError when building Jupyter Book on windows computer

See original GitHub issue

I have been getting a DeadKernelError when trying to build a jupyter book on a windows computer. I am running Python 3.7.

Steps taken :

  1. Created a new virtual environment
  2. Ran pip install -r requirements.txt
  3. Ran jupyter-book build .

Here’s my requirements.txt

pandas==1.0.5
numpy==1.19.0
matplotlib==3.2.2
datascience
folium
jupyter-book==0.8.2
sphinxcontrib-bibtex==1.0.0

When I run pip freeze, I get the following dependencies:

alabaster==0.7.12
argon2-cffi==20.1.0
async-generator==1.10
atomicwrites==1.4.0
attrs==20.3.0
Babel==2.9.0
backcall==0.2.0
beautifulsoup4==4.9.3
bleach==3.2.1
bokeh==2.2.3
branca==0.4.1
certifi==2020.11.8
cffi==1.14.3
chardet==3.0.4
click==7.1.2
colorama==0.4.4
coverage==5.3
coveralls==2.1.2
cycler==0.10.0
datascience==0.17.0
decorator==4.4.2
defusedxml==0.6.0
docopt==0.6.2
docutils==0.16
entrypoints==0.3
folium==0.11.0
gitdb==4.0.5
GitPython==3.1.11
idna==2.10
imagesize==1.2.0
importlib-metadata==2.0.0
iniconfig==1.1.1
ipykernel==5.3.4
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.17.2
Jinja2==2.11.2
jsonschema==3.2.0
jupyter-book==0.8.2
jupyter-cache==0.4.1
jupyter-client==6.1.7
jupyter-core==4.6.3
jupyter-sphinx==0.3.2
kiwisolver==1.3.1
latexcodec==2.0.1
markdown-it-py==0.5.6
MarkupSafe==1.1.1
matplotlib==3.2.2
mistune==0.8.4
myst-nb==0.10.1
myst-parser==0.12.10
nbclient==0.5.1
nbconvert==5.6.1
nbdime==2.1.0
nbformat==5.0.8
nbsphinx==0.8.0
nest-asyncio==1.4.3
notebook==6.1.5
numpy==1.19.0
oset==0.1.3
packaging==20.4
pandas==1.0.5
pandocfilters==1.4.3
parso==0.7.1
pickleshare==0.7.5
Pillow==8.0.1
plotly==4.12.0
pluggy==0.13.1
prometheus-client==0.9.0
prompt-toolkit==3.0.8
py==1.9.0
pybtex==0.23.0
pybtex-docutils==0.2.2
pycparser==2.20
pydata-sphinx-theme==0.4.1
Pygments==2.7.2
pyparsing==2.4.7
pyrsistent==0.17.3
pytest==6.1.2
python-dateutil==2.8.1
pytz==2020.4
pywin32==300
pywinpty==0.5.7
PyYAML==5.3.1
pyzmq==20.0.0
requests==2.25.0
retrying==1.3.3
scipy==1.5.4
Send2Trash==1.5.0
six==1.15.0
smmap==3.0.4
snowballstemmer==2.0.0
soupsieve==2.0.1
Sphinx==3.3.1
sphinx-book-theme==0.0.39
sphinx-comments==0.0.3
sphinx-copybutton==0.3.1
sphinx-panels==0.5.2
sphinx-thebe==0.0.8
sphinx-togglebutton==0.2.3
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-bibtex==1.0.0
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
SQLAlchemy==1.3.20
terminado==0.9.1
testpath==0.4.4
toml==0.10.2
tornado==6.1
traitlets==5.0.5
typing-extensions==3.7.4.3
urllib3==1.26.2
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
zipp==3.4.0

And here’s the error I get:

Exception occurred:
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\client.py", line 820, in async_execute_cell
    raise DeadKernelError("Kernel died")
nbclient.exceptions.DeadKernelError: Kernel died
The full traceback has been saved in C:\Users\Owoicho\AppData\Local\Temp\sphinx-err-qxfie47b.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!
Traceback (most recent call last):
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\client.py", line 816, in async_execute_cell
    exec_reply = await self.task_poll_for_reply
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\jupyter_book\sphinx.py", line 141, in build_sphinx
    app.build(force_all, filenames)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\application.py", line 352, in build
    self.builder.build_update()
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\builders\__init__.py", line 299, in build_update       
    len(to_build))
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\builders\__init__.py", line 311, in build
    updated_docnames = set(self.read())
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\builders\__init__.py", line 418, in read
    self._read_serial(docnames)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\builders\__init__.py", line 439, in _read_serial       
    self.read_doc(docname)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\builders\__init__.py", line 479, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\io.py", line 223, in read_doc
    pub.publish()
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\docutils\core.py", line 218, in publish
    self.settings)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\sphinx\io.py", line 128, in read
    self.parse()
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\docutils\readers\__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\myst_nb\parser.py", line 76, in parse
    self.env, ntbk, show_traceback=self.env.config["execution_show_tb"]
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\myst_nb\execution.py", line 142, in generate_notebook_outputs 
    allow_errors=env.config["execution_allow_errors"],
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\jupyter_cache\executors\utils.py", line 56, in single_nb_execution
    record_timing=False,
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\client.py", line 1087, in execute
    return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "C:\Users\Owoicho\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 568, in run_until_complete
    return future.result()
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\client.py", line 541, in async_execute
    cell, index, execution_count=self.code_cells_executed + 1
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\nbclient\client.py", line 820, in async_execute_cell
    raise DeadKernelError("Kernel died")
nbclient.exceptions.DeadKernelError: Kernel died

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Owoicho\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Owoicho\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Owoicho\Desktop\Turing Way\original_repo\the-turing-way\book\website\env\Scripts\jupyter-book.exe\__main__.py", line 7, in <module>
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\jupyter_book\commands\__init__.py", line 260, in build        
    result, builder, OUTPUT_PATH, build_type, PAGE_NAME, click.echo
  File "c:\users\owoicho\desktop\turing way\original_repo\the-turing-way\book\website\env\lib\site-packages\jupyter_book\commands\__init__.py", line 500, in builder_specific_actions
    raise RuntimeError(_message_box(msg, color="red", doprint=False)) from result
RuntimeError:
===============================================================================

There was an error in building your book. Look above for the cause.

===============================================================================

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
florianbussmanncommented, Feb 14, 2022

I stumbled over this as well today. Jupyter book builds every notebook it can find in the books directory, including those in your virtual environment .venv. That’s why moving your book into a subdirectory fixes this problem. Instead you can also exclude the virtual environment from Jupyter books build process by providing the following configuration in _config.yml of your book:

exclude_patterns:
- .venv/*
0reactions
gezmicommented, Jan 19, 2022

I’m getting the same behavior but only if your book contents are on the same directory as .venv/. (Running on WSL Ubuntu 20.04 in Windows 11)

BAD

myproject/
  .venv/
  _config.yml
  _toc.yml
  intro.md
  ...

$ jupyter-book build .

GOOD

myproject/
  .venv/
  mybook/
    _config.yml
    _toc.yml
    intro.md
  ...

$ jupyter-book build mybook

# This works too
$ cd mybook
$ jupyter-book build .

Thank you! This caused my problem as well, after I separated the directories, it managed to compile the book.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working on Windows - Jupyter Book
If you're running a recent version of Windows 10 and would like to build with Python 3.8 or encounter issues not covered in...
Read more >
Jupyter Book build fails after default create - Stack Overflow
I'm running conda 4.8.5 on my Windows 10 machine. I've already installed all necessary Jupyter extensions, I think (Jupyter Lab, Jupyter ...
Read more >
Jupyter Book — UBC JupyterDays 2020 - GitHub Pages
Jupyter Book is an open-source project for building books and documents from ... Linux/MacOS (Jupyter Book on Windows is an active area of...
Read more >
Bug on building the example from Jupyter Book
Hi all, I was trying to test Jupyter Books to convert my notebooks and my .md files ... but I cant execute this...
Read more >
Create a Jupyter Book extension - Azure Data Studio
Then fill in a publisher name. For this tutorial, use Microsoft. Finally, add a description. You select to either provide an existing Jupyter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found