Open dennisjlee opened 4 weeks ago
I found a workaround to force Panel to load the Material resources from CDN instead - need to add this line before serving the template:
os.environ['BOKEH_RESOURCES'] = "cdn"
However, the Material template in particular has CSS conflicts with some style rules on the page from Jupyter notebook which break the rendering (the ones I found were for #main
but there might be other conflicts).
See how the "Hello world" is hidden behind the template's header
However, when I use the "Preview with Panel" button in the notebook, that results in a page that works!
I finally noticed the tip on the documentation pages about how template styles can interact badly with notebook styles (e.g. on https://panel.holoviz.org/reference/templates/Material.html). But the original bug stands - at least a few of the templates are relying on panel.io.resources
to resolve their static resources, which try to load static resources in a way that doesn't work inside a notebook.
ALL software version info
Computer: Mac OSX 14.5, M3 Max Python: 3.10.14 Browser: Chrome 127.0.6533.100 arm64
Libraries: panel 1.4.5 bokeh 3.4.2 jupyterlab 4.2.4 jupyterlab_widgets 3.0.11 notebook 7.2.1
My panel config details:
Description of expected behavior and the observed behavior
When I try to use a panel template (like
panel.template.MaterialTemplate
orpanel.templates.BootstrapTemplate
) from a Jupyter Notebook or JupyterLab, I expect it to work.The actual behavior I'm getting is that the template fails to load CSS and JS files and therefore does not render correctly at all. It is using paths that lead to a 404 from the Jupyter server, for instance http://localhost:8888/notebooks/local_notebooks/static/extensions/panel/css/markdown.css?v=1.4.5 (note that my notebook is in a directory called
local_notebooks
relative to where the jupyter notebook server was launched).On JupyterLab, the path is slightly different but still a 404 http://localhost:8888/doc/tree/local_notebooks/static/extensions/panel/css/markdown.css?v=1.4.5
Note that the template works if I launch the notebook using
panel serve Untitled.ipynb
insteadComplete, minimal, self-contained example code that reproduces the issue
Untitled.ipynb:
Then run
Stack traceback and/or browser JavaScript console output
Browser console errors:
Screenshots or screencasts of the bug in action