jupyter-book
jupyter-book copied to clipboard
Error running `jupyter-book build` right after generating my content from the template
I am following the getting started guide. I made a new virtual env in the same folder as my book itself and this caused things to break after 19% of the way into finishing my build. Moved the virtual env out of the folder and everything worked as expected. Maybe it is silly but I feel like with how common virtual env's are, there would be some sort of check that ensures this doesn't happen. The error message is below and gave me no inclination that the env was the issue:
(env) (base) logankilpatrick@MacBook-Pro-5 Desktop % jupyter-book build JuliaCrashCourse/
Running Jupyter-Book v0.13.1
Source Folder: /Users/logankilpatrick/Desktop/JuliaCrashCourse
Config Path: /Users/logankilpatrick/Desktop/JuliaCrashCourse/_config.yml
Output Path: /Users/logankilpatrick/Desktop/JuliaCrashCourse/_build/html
Running Sphinx v4.5.0
making output directory... done
[etoc] Changing master_doc to 'intro'
checking bibtex cache... out of date
parsing bibtex file /Users/logankilpatrick/Desktop/JuliaCrashCourse/references.bib... parsed 5 entries
myst v0.15.2: MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist'], dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], url_schemes=['mailto', 'http', 'https'], heading_anchors=None, heading_slug_func=None, html_meta=[], footnote_transition=True, substitutions=[], sub_delimiters=['{', '}'], words_per_minute=200)
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 151 source files that are out of date
updating environment: [new config] 151 added, 0 changed, 0 removed
reading sources... [ 0%] env/lib/python3.10/site-packages/Jinja2-3.1.2.dist-infreading sources... [ 1%] env/lib/python3.10/site-packages/MarkupSafe-2.1.1.distreading sources... [ 1%] env/lib/python3.10/site-packages/alabaster-0.7.12.distreading sources... [ 2%] env/lib/python3.10/site-packages/attrs-21.4.0.dist-infreading sources... [ 3%] env/lib/python3.10/site-packages/bleach/_vendor/html5lreading sources... [ 4%] env/lib/python3.10/site-packages/click-8.1.3.dist-inforeading sources... [ 5%] env/lib/python3.10/site-packages/debugpy/_vendored/pydreading sources... [ 5%] env/lib/python3.10/site-packages/idna-3.4.dist-info/LIreading sources... [ 6%] env/lib/python3.10/site-packages/imagesize-1.4.1.dist-reading sources... [ 7%] env/lib/python3.10/site-packages/ipykernel-6.16.2.distreading sources... [ 7%] env/lib/python3.10/site-packages/ipython_genutils-0.2.reading sources... [ 8%] env/lib/python3.10/site-packages/jupyter_book/book_temreading sources... [ 9%] env/lib/python3.10/site-packages/jupyter_book/book_temreading sources... [ 9%] env/lib/python3.10/site-packages/jupyter_book/book_temExecuting: env/lib/python3.10/site-packages/jupyter_book/book_template/markdown-notebooks in: /Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_book/book_template
reading sources... [ 10%] env/lib/python3.10/site-packages/jupyter_book/book_temExecuting: env/lib/python3.10/site-packages/jupyter_book/book_template/notebooks in: /Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_book/book_template
reading sources... [ 11%] env/lib/python3.10/site-packages/jupyter_client-7.4.4.reading sources... [ 11%] env/lib/python3.10/site-packages/jupyter_core-4.11.2.dreading sources... [ 12%] env/lib/python3.10/site-packages/jupyter_server-1.21.0reading sources... [ 13%] env/lib/python3.10/site-packages/jupyter_server/i18n/Rreading sources... [ 13%] env/lib/python3.10/site-packages/latexcodec-2.0.1.distreading sources... [ 14%] env/lib/python3.10/site-packages/latexcodec-2.0.1.distreading sources... [ 15%] env/lib/python3.10/site-packages/matplotlib/backends/wExecuting: env/lib/python3.10/site-packages/matplotlib/backends/web_backend/nbagg_uat in: /Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/matplotlib/backends/web_backend
reading sources... [ 15%] env/lib/python3.10/site-packages/mdit_py_plugins/contareading sources... [ 16%] env/lib/python3.10/site-packages/mdit_py_plugins/deflireading sources... [ 17%] env/lib/python3.10/site-packages/mdit_py_plugins/texmareading sources... [ 17%] env/lib/python3.10/site-packages/mistune-0.8.4.dist-inreading sources... [ 18%] env/lib/python3.10/site-packages/nbclassic/bundler/tesExecuting: env/lib/python3.10/site-packages/nbclassic/bundler/tests/resources/empty in: /Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclassic/bundler/tests/resources
reading sources... [ 19%] env/lib/python3.10/site-packages/nbclient/tests/files/Executing: env/lib/python3.10/site-packages/nbclient/tests/files/Autokill in: /Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/tests/files
/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_book/book_template/intro.md:: WARNING: tableofcontents directive in document with no descendants [etoc.tableofcontents]
/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/matplotlib/backends/web_backend/nbagg_uat.ipynb:20002: WARNING: Non-consecutive header level increase; 0 to 2 [myst.header]
/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/matplotlib/backends/web_backend/nbagg_uat.ipynb:330002: WARNING: Non-consecutive header level increase; 0 to 2 [myst.header]
Exception occurred:
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/client.py", line 953, in async_execute_cell
raise DeadKernelError("Kernel died")
nbclient.exceptions.DeadKernelError: Kernel died
The full traceback has been saved in /var/folders/tc/519vfm453fj_x5bmd8pwx9480000gn/T/sphinx-err-b4x2rssg.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 "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/client.py", line 730, in _async_poll_for_reply
msg = await ensure_async(self.kc.shell_channel.get_msg(timeout=new_timeout))
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/util.py", line 96, in ensure_async
result = await obj
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_client/channels.py", line 224, in get_msg
ready = await self.socket.poll(timeout)
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/client.py", line 949, in async_execute_cell
exec_reply = await self.task_poll_for_reply
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_book/sphinx.py", line 171, in build_sphinx
app.build(force_all, filenames)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/application.py", line 330, in build
self.builder.build_update()
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 286, in build_update
self.build(to_build,
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 300, in build
updated_docnames = set(self.read())
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 407, in read
self._read_serial(docnames)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 428, in _read_serial
self.read_doc(docname)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 468, in read_doc
doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/io.py", line 181, in read_doc
pub.publish()
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/docutils/core.py", line 217, in publish
self.document = self.reader.read(self.source, self.parser,
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/sphinx/io.py", line 101, in read
self.parse()
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/docutils/readers/__init__.py", line 78, in parse
self.parser.parse(self.input, document)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/myst_nb/parser.py", line 67, in parse
ntbk = generate_notebook_outputs(
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/myst_nb/execution.py", line 137, in generate_notebook_outputs
result = single_nb_execution(
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_cache/executors/utils.py", line 51, in single_nb_execution
executenb(
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/client.py", line 1204, in execute
return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/util.py", line 84, in wrapped
return just_run(coro(*args, **kwargs))
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/util.py", line 62, in just_run
return loop.run_until_complete(coro)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/client.py", line 663, in async_execute
await self.async_execute_cell(
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/nbclient/client.py", line 953, 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 "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/bin/jupyter-book", line 8, in <module>
sys.exit(main())
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_book/cli/main.py", line 323, in build
builder_specific_actions(
File "/Users/logankilpatrick/Desktop/JuliaCrashCourse/env/lib/python3.10/site-packages/jupyter_book/cli/main.py", line 531, 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.
===============================================================================
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
@logankilpatrick I encountered the same issue as you did. And I fixed it by reinstalling jupyter-book using pip instead of conda.
I had a similar issue in sphinx. I think it's because Jupyter book is trying to execute notebooks from your virtual environment folder, specifically
env/lib/python3.10/site-packages/nbclient/tests/files/Autokill
which kills the kernel. I fixed mine by adding this folder to the exclude_patterns
in the config:
exclude_patterns = ['env/*']
I had the same issue when .venv
is in my folder, but
exclude_patterns:
- '.venv/*'
solved this for me.
Here's the full _config.yml
that fixes this issue:
# Book settings
# Learn more at https://jupyterbook.org/customize/config.html
title: My sample book
author: The Jupyter Book Community
logo: logo.png
# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: force
# Define the name of the latex output file for PDF builds
latex:
latex_documents:
targetname: book.tex
# Add a bibtex file so that we can create citations
bibtex_bibfiles:
- references.bib
# Information about where the book exists on the web
repository:
url: https://github.com/executablebooks/jupyter-book # Online location of your book
path_to_book: docs # Optional path to your book, relative to the repository root
branch: master # Which branch of the repository should be used when creating links (optional)
# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
html:
use_issues_button: true
use_repository_button: true
exclude_patterns:
- '.venv/*'