Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building came across Extension error #1902

Open
ivaquero opened this issue Jan 3, 2023 · 3 comments
Open

Building came across Extension error #1902

ivaquero opened this issue Jan 3, 2023 · 3 comments

Comments

@ivaquero
Copy link

ivaquero commented Jan 3, 2023

I came across Extension error when building jupyter book. It's the first time for me to see the following messages, I know how to deal with these. Please help.

Source Folder: /Users/iam/Documents/blog
Config Path: /Users/iam/Documents/blog/_config.yml
Output Path: /Users/iam/Documents/blog/_build/html
Running Sphinx v4.5.0
[etoc] Changing master_doc to 'README'
[etoc] Excluded 47 extra file(s) not in toc
parsing bibtex file /Users/iam/Documents/blog/references.bib... parsed 5 entries
checking bibtex cache... out of date
myst v0.15.2: MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['colon_fence', 'dollarmath', 'linkify', 'substitution'], 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 47 source files that are out of date
updating environment: executing outdated notebooks... failed

Extension error (myst_nb.execution):
Handler <function update_execution_cache at 0x10782c680> for event 'env-get-outdated' threw an exception (exception: (jsonschema 3.2.0 (/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages), Requirement.parse('jsonschema[format-nongpl]>=4.3.0'), {'jupyter-events'}))
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/sphinx/events.py", line 94, in emit
    results.append(listener.handler(self.app, *args))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/myst_nb/execution.py", line 76, in update_execution_cache
    _stage_and_execute(
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/myst_nb/execution.py", line 279, in _stage_and_execute
    execute_staged_nb(
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/myst_nb/execution.py", line 311, in execute_staged_nb
    executor = load_executor("basic", cache_base, logger=LOGGER)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/jupyter_cache/executors/base.py", line 78, in load_executor
    execute_cls = entry_points[0].load()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2470, in load
    self.require(*args, **kwargs)
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2493, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/pkg_resources/__init__.py", line 800, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (jsonschema 3.2.0 (/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages), Requirement.parse('jsonschema[format-nongpl]>=4.3.0'), {'jupyter-events'})

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

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/jupyter_book/sphinx.py", line 171, in build_sphinx
    app.build(force_all, filenames)
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/sphinx/application.py", line 330, in build
    self.builder.build_update()
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 286, in build_update
    self.build(to_build,
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 300, in build
    updated_docnames = set(self.read())
                           ^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/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 "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/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 0x10782c680> for event 'env-get-outdated' threw an exception (exception: (jsonschema 3.2.0 (/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages), Requirement.parse('jsonschema[format-nongpl]>=4.3.0'), {'jupyter-events'}))

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

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/bin/jupyter-book", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/site-packages/jupyter_book/cli/main.py", line 323, in build
    builder_specific_actions(
  File "/opt/homebrew/Caskroom/mambaforge-cn/base/lib/python3.11/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.

===============================================================================
@ivaquero
Copy link
Author

ivaquero commented Jan 7, 2023

Update: after changing cache to force in the following block, this 'ExtensionError' can be skipped.

execute:
  execute_notebooks: force

@maxbane
Copy link
Contributor

maxbane commented Jan 17, 2023

@ivaquero if you want to preserve caching behavior, instead of disabling the cache with execute_notebooks: force, try adding jupyter-server < 2 to your project's dependencies (at least for building docs) and rebuilding your virtual environment. See #1907 for context.

@ivaquero
Copy link
Author

Thank you for sharing. I will try.

grahamgower added a commit to grahamgower/demes-spec that referenced this issue Mar 11, 2023
Fix the following error by pinning jupyter-server.
```
sphinx.errors.ExtensionError: Handler <function update_execution_cache at 0x7f2c8d7cc1f0> for event 'env-get-outdated' threw an exception (exception: jsonschema 3.2.0 has no such extra feature 'format-nongpl')
```

Alternative fixes include disabling notebook caching,
and updating jupyter-book (which needs other changes).
executablebooks/jupyter-book#1902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants