voila-dashboards / voila

Voilà turns Jupyter notebooks into standalone web applications
https://voila.readthedocs.io
Other
5.37k stars 499 forks source link

Possibility to integrate third party extension #892

Open HuifangYeo opened 3 years ago

HuifangYeo commented 3 years ago

Hi,

I'm trying to use atoti with voila. atoti has its own JupyterLab extension and I can't find a way to make it work with voila.

image

I get this error: image

[E 2021-05-19 12:42:10.557 ServerApp] Uncaught exception GET /voila/render/notebooks/random/Untitled.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/voila/render/notebooks/random/Untitled.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\tornado\web.py", line 1704, in _execute
        result = await result
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\voila\handler.py", line 154, in get
        async for html_snippet, resources in self.exporter.generate_from_notebook_node(notebook, resources=resources, extra_context=extra_context):
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\voila\exporter.py", line 100, in generate_from_notebook_node
        async for output in self.template.generate_async(nb=nb_copy, resources=resources, **extra_context, static_url=self.static_url):
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jinja2\asyncsupport.py", line 35, in generate_async
        yield self.environment.handle_exception()
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jinja2\environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jinja2\_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\voila\templates\lab\index.html.j2", line 4, in top-level template code
        {% from 'voila_setup.macro.html.j2' import voila_setup with context %}
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\nbconvert\templates\lab\index.html.j2", line 3, in top-level template code
        {% from 'jupyter_widgets.html.j2' import jupyter_widgets %}
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\nbconvert\templates\lab\base.html.j2", line 224, in top-level template code
        {% set div_id = uuid4() %}
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\nbconvert\templates\base\display_priority.j2", line 1, in top-level template code
        {%- extends 'base/null.j2' -%}
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\nbconvert\templates\base\null.j2", line 26, in top-level template code
        {%- block body -%}
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\nbconvert\templates\base\null.j2", line 29, in block "body"
        {%- block body_loop -%}
      File "C:\Apps\miniconda3\envs\atoti\share\jupyter\voila\templates\lab\index.html.j2", line 55, in block "body_loop"
        {%- block body_loop -%}
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jinja2\asyncsupport.py", line 174, in auto_await
        return await value
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\voila\handler.py", line 179, in _jinja_kernel_start
        await ensure_async(self.executor.kc.start_channels())
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jupyter_client\client.py", line 106, in start_channels
        self.iopub_channel.start()
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jupyter_client\client.py", line 162, in iopub_channel
        socket = self.connect_iopub()
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jupyter_client\connect.py", line 558, in connect_iopub
        sock = self._create_connected_socket('iopub', identity=identity)
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\jupyter_client\connect.py", line 548, in _create_connected_socket
        sock = self.context.socket(socket_type)
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\zmq\sugar\context.py", line 235, in socket
        s = self._socket_class(self, socket_type, **kwargs)
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\zmq\_future.py", line 150, in __init__
        self._init_io_state()
      File "C:\Apps\miniconda3\envs\atoti\lib\site-packages\zmq\asyncio.py", line 51, in _init_io_state
        self.io_loop.add_reader(self._fd, lambda: self._handle_events(0, 0))
      File "C:\Apps\miniconda3\envs\atoti\lib\asyncio\events.py", line 504, in add_reader
        raise NotImplementedError
    NotImplementedError
[E 2021-05-19 12:42:10.573 ServerApp] Cannot send error response after headers written

Please see the attached notebook. atoti.zip

jtpio commented 3 years ago

Thanks @HuifangYeo.

Linking to #846 which should help support third-party JupyterLab extensions more easily.