-
Notifications
You must be signed in to change notification settings - Fork 504
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
require.js is loaded after plotly needs it #141
Comments
I just tried to put require.js in the head of the template (not ideal I know) but it works and my plot renders. I'll use a custom template for now but I would love to hear your thoughts about this. |
If someone else stumble upon this issue, what I did to fix it is: |
@leogout Thanks for sharing this. What was the explicit code that you used for loading |
In the template I overrided, I used this code (click me):
{%- extends 'basic.tpl' -%}
{% from 'mathjax.tpl' import mathjax %}
{%- block header -%}
<!DOCTYPE html>
<html>
<head>
{%- block html_head -%}
<meta charset="utf-8" />
{% set nb_title = nb.metadata.get('title', '') or resources['metadata']['name'] %}
<title>Voila: {{nb_title}}</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/font-awesome.min.css" type="text/css" />
{%- block html_head_js -%}
<script src="{{resources.base_url}}voila/static/jquery.min.js"></script>
<script
src="{{resources.base_url}}voila/static/require.min.js"
integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA="
crossorigin="anonymous">
</script>
<script id="jupyter-config-data" type="application/json">
{
"baseUrl": "{{resources.base_url}}",
"kernelId": "{{resources.kernel_id}}"
}
</script>
{%- endblock html_head_js -%}
{%- block html_head_css -%}
{%- endblock html_head_css -%}
{%- endblock html_head -%}
</head>
{%- endblock header -%}
{% block footer %}
{% block footer_js %}
<script>
requirejs.config({ baseUrl: '{{resources.base_url}}voila/', waitSeconds: 30})
requirejs(
[
"static/main",
{% for ext in resources.nbextensions -%}
"{{resources.base_url}}voila/nbextensions/{{ ext }}.js",
{% endfor %}
]
)
</script>
{% endblock footer_js %}
{{ super() }}
</html>
{% endblock footer %} |
I tried to use plotly in a notebook with the following code (from plotly's doc):
It runs well in my local jupyterlab instance:
But when I try to launch it with voila it gives me a blank output cell with the error:
When I inspected the template I found that plotly tries to use require.js before it gets imported (in the base template it is at the bottom of the file)
How can I get my graph to work with voila ?
The text was updated successfully, but these errors were encountered: