You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to load an image with markdown, the notebook stops loading.
It only happens with markdown image syntax (HTML or Image IPython widget are fine), and only when using voila in Jupyter Lab/Server, not when using voila standalone (python -m voila).
It raise the exception TypeError: 'coroutine' object is not subscriptable (see Command line output)
Reproduce
Start Jupyter (python -m jupyter notebook)
Open a notebook containing an image
Click the "Render with Voila" button
I managed to replicate this behavior in Binder, in a normal Python installation, and in a conda environment, with Voila installed from source (i followed the contributing guide)
Expected behavior
The image & the rest of the notebook should render, like when using an HTML image.
Context
voila version: 0.5.7
Operating System and version: Ubuntu 22.04.4 LTS, Debian 12, Binder
Command Line Output
Output of jupyter server since running `voila` works
python -m jupyter_server
[I 2024-05-27 13:07:06.434 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-05-27 13:07:06.436 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-05-27 13:07:06.439 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-05-27 13:07:06.441 ServerApp] notebook | extension was successfully linked.
/home/enzo/.local/lib/python3.12/site-packages/traitlets/traitlets.py:1897: DeprecationWarning: ServerApp.token config is deprecated in jupyter-server 2.0. Use IdentityProvider.token
return t.cast(Sentinel, self._get_trait_default_generator(names[0])(self))
[I 2024-05-27 13:07:06.582 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-05-27 13:07:06.583 ServerApp] voila.server_extension | extension was successfully linked.
[I 2024-05-27 13:07:06.590 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-05-27 13:07:06.591 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-05-27 13:07:06.592 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-05-27 13:07:06.593 LabApp] JupyterLab extension loaded from /opt/miniconda/envs/voila/lib/python3.12/site-packages/jupyterlab
[I 2024-05-27 13:07:06.593 LabApp] JupyterLab application directory is /opt/miniconda/envs/voila/share/jupyter/lab
[I 2024-05-27 13:07:06.593 LabApp] Extension Manager is 'pypi'.
[I 2024-05-27 13:07:06.601 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-05-27 13:07:06.604 ServerApp] notebook | extension was successfully loaded.
[I 2024-05-27 13:07:06.606 ServerApp] voila.server_extension | extension was successfully loaded.
[I 2024-05-27 13:07:06.606 ServerApp] Serving notebooks from local directory: /home/enzo/dev/voila/voila/notebooks
[I 2024-05-27 13:07:06.606 ServerApp] Jupyter Server 2.14.0 is running at:
[I 2024-05-27 13:07:06.606 ServerApp] http://localhost:8888/?token=0b74eec78a0b87794c030203c4b9c08fa7292746efb62384
[I 2024-05-27 13:07:06.606 ServerApp] http://127.0.0.1:8888/?token=0b74eec78a0b87794c030203c4b9c08fa7292746efb62384
[I 2024-05-27 13:07:06.606 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-05-27 13:07:06.608 ServerApp]
To access the server, open this file in a browser:
file:///home/enzo/.local/share/jupyter/runtime/jpserver-22671-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=0b74eec78a0b87794c030203c4b9c08fa7292746efb62384
http://127.0.0.1:8888/?token=0b74eec78a0b87794c030203c4b9c08fa7292746efb62384
[I 2024-05-27 13:07:06.842 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2024-05-27 13:07:09.169 ServerApp] Kernel started: 05ef4034-697e-4c0e-8dbf-621ef758d99f
/home/enzo/dev/voila/voila/voila/exporter.py:53: RuntimeWarning: coroutine 'AsyncFileContentsManager.file_exists' was never awaited
if contents_manager.file_exists(src):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task exception was never retrieved
future: <Task finished name='Task-36' coro=<VoilaHandler.get_generator..put_html() done, defined at /home/enzo/dev/voila/voila/voila/handler.py:240> exception=TypeError("'coroutine' object is not subscriptable")>
Traceback (most recent call last):
File "/home/enzo/dev/voila/voila/voila/handler.py", line 241, in put_html
async for html_snippet, _ in gen.generate_content_generator(
File "/home/enzo/dev/voila/voila/voila/exporter.py", line 158, in generate_from_notebook_node
async for output in self.template.generate_async(
File "/home/enzo/.local/lib/python3.12/site-packages/jinja2/environment.py", line 1376, in generate_async
yield self.environment.handle_exception()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/enzo/.local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/enzo/dev/voila/voila/share/jupyter/voila/templates/lab/index.html.j2", line 4, in top-level template code
{% from 'voila_setup.macro.html.j2' import voila_setup_helper_functions, voila_setup_labextensions with context %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/lab/index.html.j2", line 4, in top-level template code
{% from 'jupyter_widgets.html.j2' import jupyter_widgets %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/lab/base.html.j2", line 3, in top-level template code
{% from 'cell_id_anchor.j2' import cell_id_anchor %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/base/display_priority.j2", line 1, in top-level template code
{%- extends 'base/null.j2' -%}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/base/null.j2", line 26, in top-level template code
{%- block body -%}
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/base/null.j2", line 29, in block 'body'
{%- block body_loop -%}
File "/home/enzo/dev/voila/voila/share/jupyter/voila/templates/lab/index.html.j2", line 106, in block 'body_loop'
{%- block any_cell scoped -%}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/enzo/dev/voila/voila/share/jupyter/voila/templates/lab/index.html.j2", line 111, in block 'any_cell'
{{ super() }}
File "/home/enzo/.local/lib/python3.12/site-packages/jinja2/async_utils.py", line 65, in auto_await
return await t.cast("t.Awaitable[V]", value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/base/null.j2", line 87, in block 'any_cell'
{%- block markdowncell scoped-%} {%- endblock markdowncell -%}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/share/jupyter/nbconvert/templates/lab/base.html.j2", line 109, in block 'markdowncell'
{%- set html_value=cell.source | markdown2html | strip_files_prefix -%}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/enzo/dev/voila/voila/voila/exporter.py", line 102, in markdown2html
return MarkdownWithMath(renderer=renderer).render(source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/nbconvert/filters/markdown_mistune.py", line 484, in render
return str(super().call(source))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/markdown.py", line 110, in call
return self.parse(s)[0]
^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/markdown.py", line 90, in parse
result = self.render_state(state)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/markdown.py", line 48, in render_state
return self.renderer(data, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/core.py", line 209, in call
return self.render_tokens(tokens, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/core.py", line 206, in render_tokens
return ''.join(self.iter_tokens(tokens, state))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/core.py", line 203, in iter_tokens
yield self.render_token(tok, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/renderers/html.py", line 34, in render_token
text = self.render_tokens(token['children'], state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/core.py", line 206, in render_tokens
return ''.join(self.iter_tokens(tokens, state))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/core.py", line 203, in iter_tokens
yield self.render_token(tok, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda/envs/voila/lib/python3.12/site-packages/mistune/renderers/html.py", line 41, in render_token
return func(text, **attrs)
^^^^^^^^^^^^^^^^^^^
File "/home/enzo/dev/voila/voila/voila/exporter.py", line 55, in image
data = content["content"].replace("\n", "") # remove the newline
~~~~~~~^^^^^^^^^^^
TypeError: 'coroutine' object is not subscriptable
The text was updated successfully, but these errors were encountered:
Description
When trying to load an image with markdown, the notebook stops loading.
It only happens with markdown image syntax (HTML or Image IPython widget are fine), and only when using voila in Jupyter Lab/Server, not when using voila standalone (
python -m voila
).It raise the exception
TypeError: 'coroutine' object is not subscriptable
(see Command line output)Reproduce
python -m jupyter notebook
)I managed to replicate this behavior in Binder, in a normal Python installation, and in a conda environment, with Voila installed from source (i followed the contributing guide)
Expected behavior
The image & the rest of the notebook should render, like when using an HTML image.
Context
Troubleshoot Output
Command Line Output
Output of jupyter server since running `voila` worksThe text was updated successfully, but these errors were encountered: