Closed ClaytonAstrom closed 8 months ago
Hi, could you clarify what is your extension and what is the error you get? Generally, voila always requires having a running kernel to execute the notebook, the changes in 0.5.0 only relate to the way we render the widgets.
Sure thing @trungleduc - our extension is a small wrapper to point to proxies for our custom widgets so that our python package can load these components. The error that is thrown is actually here - https://github.com/voila-dashboards/voila/blob/main/packages/voila/src/plugins/widget/index.ts#L65
That's because the kernelid
is just ""
at the time, so the route doesn't match the pattern here - https://github.com/voila-dashboards/voila/blob/main/packages/voila/src/plugins/widget/index.ts#L65, so the kernelapi call is a 404 and the model is undefined.
are you using a custom template? the kernelId
is injected into the HTML page via the Jinja template, e.g:
The above step is called on the kernel startup and before any js calls, so when voila activates the widgetManager
plugin, the kernel id should be available already.
Ahh we are it looks like - looks like we're copying the template for 0.4 -
{%- block body_loop -%}
{# from this point on, the kernel is started #}
{%- with kernel_id = kernel_start(nb) -%}
<script id="jupyter-config-data" type="application/json">
{
"baseUrl": "{{resources.base_url}}",
"kernelId": "{{kernel_id}}"
}
</script>
{% set cell_count = nb.cells|length %}
{#
Voilà is using Jinja's Template.generate method to not render the whole template in one go.
The current implementation of Jinja will however not yield template snippets if we call a blocks' super()
Therefore it is important to have the cell loop in the template.
The issue for Jinja is: https://github.com/pallets/jinja/issues/1044
#}
{%- for cell in cell_generator(nb, kernel_id) -%}
{% set cellloop = loop %}
{%- block any_cell scoped -%}
<script>
voila_process({{ cellloop.index }}, {{ cell_count }})
</script>
{{ super() }}
{%- endblock any_cell -%}
{%- endfor -%}
{% endwith %}
{%- endblock body_loop -%}
Let me try the new template and see if that helps
Alright I've removed any of our custom templates (which was mostly font and custom loading icons), so my current test is just with voila's default templates. Unfortunately though I still see the same result, the 404 and failed to activate
when first loading the voila homepage.
Is there anything about the extension that needs to be migrated or is this strictly from something with the template? I don't see these issues with a plain jupyter4 image when we install the extension, so I'm fairly confident it's something that isn't playing nice with voila
Do you have the error in the tree page of Voila or the actual dashboard? Having a 404 error and an extension has failed to activate in the tree page is normal, since you don't use widget extensions in the tree page anyway.
FYI, in Voila 0.5 you can create a jupyterlab extension targeting Voila by checking the app name, e.g. the top bar extension (https://github.com/voila-dashboards/voila-topbar). So you don't need to go through the template to inject CSS and font to a dashboard.
Do you have the error in the tree page of Voila or the actual dashboard? Having a 404 error and an extension has failed to activate in the tree page is normal, since you don't use widget extensions in the tree page anyway.
It's in the tree view, yeah. Ok if that's expected let me double check our original issue then where the notebook was failing to render to render these components - I had presumed this registration failure was related.
Ok, looks like with a minimal setup the notebook actually works correctly. This is probably something with our config then, thank you!
Problem
We're migrating from voila 0.4 to 0.5. We have an extension we've built for jupyter that we had been using in voila 0.4. However, in voila 0.5, it seems that it requires a kernel now? Is that intentional?
https://github.com/voila-dashboards/voila/blob/main/packages/voila/src/plugins/widget/index.ts#L58
Is there any documentation around how we need to modify our extension to actually successfully register? The
kernelid
at this point seems to need an actual running kernel, so I'm not sure how the extension would have that info.