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

voila broken due to nbformat update #1450

Open
edublancas opened this issue Mar 13, 2024 · 3 comments
Open

voila broken due to nbformat update #1450

edublancas opened this issue Mar 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@edublancas
Copy link
Contributor

Description

opening this in case anyone else runs into this issue

Voila breaks when using the newest nbformat version 5.10.2, downgrading to 5.9.2 fixes the issue

might be related to this? jupyter/nbformat#396

Reproduce

Install voila with nbformat==5.10.2, try opening the app and you'll see 500: Internal Server Error, with this error in the console:

[Voila] Using /tmp to store connection files
[Voila] Storing connection files in /tmp/voila_x5sesrh7.
[Voila] Serving static files from /usr/local/lib/python3.11/site-packages/voila/static.
[Voila] Voilà is running at:
http://9b942bc1d8d7:80/
[Voila] WARNING | Clearing invalid/expired login cookie username-0-0-0-0-5000
[Voila] WARNING | The signatures database cannot be opened; maybe it is corrupted or encrypted. You may need to rerun your notebooks to ensure that they are trusted to run Javascript. The old signatures database has been renamed to /root/.local/share/jupyter/nbsignatures.db.bak and a new one has been created.
[Voila] WARNING | Failed committing signatures database to disk. You may need to move the database file to a non-networked file system, using config option `NotebookNotary.db_file`. Using in-memory signatures database for the remainder of this session.
[Voila] Writing notebook-signing key to /root/.local/share/jupyter/notebook_secret
Uncaught exception GET / (172.17.0.1)
HTTPServerRequest(protocol='http', host='0.0.0.0:5000', method='GET', uri='/', version='HTTP/1.1', remote_ip='172.17.0.1')
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/traitlets/traitlets.py", line 632, in get
    value = obj._trait_values[self.name]
            ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'secret'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
    result = await result
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/voila/tornado/handler.py", line 18, in get
    async for html in gen:
  File "/usr/local/lib/python3.11/site-packages/voila/handler.py", line 210, in get_generator
    await gen.initialize(template=template_arg, theme=theme_arg)
  File "/usr/local/lib/python3.11/site-packages/voila/notebook_renderer.py", line 61, in initialize
    self.notebook = await self.load_notebook(notebook_path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/voila/notebook_renderer.py", line 309, in load_notebook
    model = await ensure_async(self.contents_manager.get(path=path))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jupyter_server/services/contents/filemanager.py", line 454, in get
    model = self._notebook_model(path, content=content, require_hash=require_hash)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jupyter_server/services/contents/filemanager.py", line 398, in _notebook_model
    self.mark_trusted_cells(nb, path)
  File "/usr/local/lib/python3.11/site-packages/jupyter_server/services/contents/manager.py", line 738, in mark_trusted_cells
    trusted = self.notary.check_signature(nb)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nbformat/sign.py", line 461, in check_signature
    signature = self.compute_signature(nb)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nbformat/sign.py", line 436, in compute_signature
    hmac = HMAC(self.secret, digestmod=self.digestmod)
                ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/traitlets/traitlets.py", line 687, in __get__
    return t.cast(G, self.get(obj, cls))  # the G should encode the Optional
                     ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/traitlets/traitlets.py", line 635, in get
    default = obj.trait_defaults(self.name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1897, in trait_defaults
    return t.cast(Sentinel, self._get_trait_default_generator(names[0])(self))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1241, in __call__
    return self.func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nbformat/sign.py", line 412, in _secret_default
    self._write_secret_file(secret)
  File "/usr/local/lib/python3.11/site-packages/nbformat/sign.py", line 423, in _write_secret_file
    with Path(self.secret_file).open("wb") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/root/.local/share/jupyter/notebook_secret'
500 GET / (172.17.0.1) 389.22ms

Expected behavior

I'd expect the app to work

Context

  • voila version
  • Operating System and version:
  • Browser and version:
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `voila` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here.

If using JupyterLab

  • JupyterLab version:
Installed Labextensions
Paste the output from your command line running `jupyter labextension list`.
@maartenbreddels
Copy link
Member

Thanks, we noticed this in our ci for ipyvuetify a solara as well, but couldn’t find out why as fast as you!

@jtpio
Copy link
Member

jtpio commented Mar 14, 2024

The upstream change was reverted: jupyter/nbformat#397

So maybe this will be fixed when there is a new release of nbformat.

@krassowski
Copy link

New release is up: https://github.com/jupyter/nbformat/releases/tag/v5.10.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants