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

HTML conversion fails with nbformat 5.5.0 #303

Open
holl- opened this issue Sep 19, 2022 · 3 comments
Open

HTML conversion fails with nbformat 5.5.0 #303

holl- opened this issue Sep 19, 2022 · 3 comments

Comments

@holl-
Copy link

holl- commented Sep 19, 2022

Since the release of nbformat 5.5.0, the conversion of this notebook fails on GitHub Actions.
We have reverted to 5.4.0, which works correctly.
This is the error log with 5.5.0:

[NbConvertApp] Converting notebook docs/Math_Introduction.ipynb to html
[NbConvertApp] ERROR | Notebook JSON is invalid: data.cells[{data__cells_x}] must be valid exactly by one definition (0 matches found)

Failed validating <unset> in notebook['data']['cells']:

On instance:
<unset>
[NbConvertApp] ERROR | Notebook is invalid after preprocessor <nbconvert.preprocessors.tagremove.TagRemovePreprocessor object at 0x7f086ea7f460>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.13/x64/bin/jupyter-nbconvert", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/traitlets/config/application.py", line 978, in launch_instance
    app.start()
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 426, in start
    self.convert_notebooks()
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 600, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 563, in convert_single_notebook
    output, resources = self.export_single_notebook(
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 491, in export_single_notebook
    output, resources = self.exporter.from_filename(
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 190, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 207, in from_file
    return self.from_notebook_node(
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/html.py", line 223, in from_notebook_node
    return super().from_notebook_node(nb, resources, **kw)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line [38](https://github.com/tum-pbs/PhiFlow/actions/runs/3044041976/jobs/4904884808#step:7:39)6, in from_notebook_node
    nb_copy, resources = super().from_notebook_node(nb, resources, **kw)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 147, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 3[44](https://github.com/tum-pbs/PhiFlow/actions/runs/3044041976/jobs/4904884808#step:7:45), in _preprocess
    self._validate_preprocessor(nbc, preprocessor)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 311, in _validate_preprocessor
    nbformat.validate(nbc)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nbformat/validator.py", line [50](https://github.com/tum-pbs/PhiFlow/actions/runs/3044041976/jobs/4904884808#step:7:51)3, in validate
    raise error
nbformat.validator.NotebookValidationError: data.cells[{data__cells_x}] must be valid exactly by one definition (0 matches found)

Failed validating <unset> in notebook['data']['cells']:

On instance:
<unset>
@marscher
Copy link

After receiving the newly introduced warning about missing cell ids MissingIDFieldWarning, I transformed my notebooks to have the IDs generated and saved on disk.
But the validation now fails as reported by @holl-

I tried to follow it in the debugger, but there seems no schema is being used to validate the data at all...

Since this is a blocker of the new version, I'd kindly ask you guys to look into this quickly. Thanks a lot!

@marscher
Copy link

With nbformat-5.7 the validation message about ids has gone. But I had to regenerate the notebooks with the same version and omit the major/minor version (4, 5) in normalize().

@mspronesti
Copy link

mspronesti commented Oct 20, 2022

This error seems to be persisting even in 5.7.0. Only reverting to 5.4.0 worked for me.

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

3 participants