jupyter-book: JupyterBook fails to build when setting `execute_notebooks: cache`
Describe the bug
context
When I install jupyter-book from pip, create a new project and try to build the book with execute_notebooks: cache it fails to build the book.
expectation I expected the book to build without any error
bug But instead it fails to build the book. Here’s an error message I ran into
$ jupyter-book build docs
Running Jupyter-Book v0.13.1
Source Folder: /Users/finsberg/mwe/docs
Config Path: /Users/finsberg/mwe/docs/_config.yml
Output Path: /Users/finsberg/mwe/docs/_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/finsberg/mwe/docs/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 4 source files that are out of date
updating environment: executing outdated notebooks... failed
Extension error (myst_nb.execution):
Handler <function update_execution_cache at 0x10aa61870> for event 'env-get-outdated' threw an exception (exception: jsonschema 3.2.0 has no such extra feature 'format-nongpl')
Traceback (most recent call last):
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2760, in requires
deps.extend(dm[safe_extra(ext)])
KeyError: 'format-nongpl'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/sphinx/events.py", line 94, in emit
results.append(listener.handler(self.app, *args))
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/myst_nb/execution.py", line 76, in update_execution_cache
_stage_and_execute(
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/myst_nb/execution.py", line 279, in _stage_and_execute
execute_staged_nb(
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/myst_nb/execution.py", line 311, in execute_staged_nb
executor = load_executor("basic", cache_base, logger=LOGGER)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/jupyter_cache/executors/base.py", line 78, in load_executor
execute_cls = entry_points[0].load()
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2470, in load
self.require(*args, **kwargs)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2493, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 803, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2762, in requires
raise UnknownExtra(
pkg_resources.UnknownExtra: jsonschema 3.2.0 has no such extra feature 'format-nongpl'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/jupyter_book/sphinx.py", line 171, in build_sphinx
app.build(force_all, filenames)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/sphinx/application.py", line 330, in build
self.builder.build_update()
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 286, in build_update
self.build(to_build,
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 300, in build
updated_docnames = set(self.read())
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 371, in read
for docs in self.events.emit('env-get-outdated', self.env, added, changed, removed):
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/sphinx/events.py", line 102, in emit
raise ExtensionError(__("Handler %r for event %r threw an exception") %
sphinx.errors.ExtensionError: Handler <function update_execution_cache at 0x10aa61870> for event 'env-get-outdated' threw an exception (exception: jsonschema 3.2.0 has no such extra feature 'format-nongpl')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/finsberg/mwe/venv/bin/jupyter-book", line 8, in <module>
sys.exit(main())
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/finsberg/mwe/venv/lib/python3.10/site-packages/jupyter_book/cli/main.py", line 323, in build
builder_specific_actions(
File "/Users/finsberg/mwe/venv/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.
===============================================================================
Reproduce the bug
pip install jupyter-bookjupyter-book create docs- In
docs/_config.ymlchange
execute:
execute_notebooks: force
to
execute:
execute_notebooks: cache
- Run
jupyter-book build docs
Note that if I instead install the version on the master branch, i.e as step 1 I instead do
pip install git+https://github.com/executablebooks/jupyter-book.git@master
it works as expected again, so I think this could be fixed by just creating new wheel with the current developement version
List your environment
jupyter-book --version
Jupyter Book : 0.13.1
External ToC : 0.2.4
MyST-Parser : 0.15.2
MyST-NB : 0.13.2
Sphinx Book Theme : 0.3.3
Jupyter-Cache : 0.4.3
NbClient : 0.5.13
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 20 (18 by maintainers)
Commits related to this issue
- Temporary workaround due to https://github.com/executablebooks/jupyter-book/issues/1907 — committed to RangamaniLabUCSD/smart by jorgensd a year ago
Found a workaround. Adding
jupyter-server < 2to my project’s documentation dependencies solves the problem for my tox build.Likewise, in my minimally reproducible example linked above, if you replace
pip install jupyter-bookwithpip install jupyter-book "jupyter-server < 2", then the sphinx build succeeds with notebook caching enabled.With that version cap in place, pip ends up installing
jupyter-server1.23.5 (instead of 2.1.0 with no cap), which doesn’t depend on the problematicjupyter-events.Hum - trying again now with
--no-cache-dirI do not get the warning, or the error. I think you can close (although I wish I understood what had changed in the meantime).The pip install warning persists for me, as does the build error, in an install in a fresh virtualenv.