panel icon indicating copy to clipboard operation
panel copied to clipboard

CSS is missing when inlining static resources.

Open sunilkr opened this issue 2 years ago • 4 comments

When using inline=True, some of the CSS files are not loaded inline and request is sent to CDN. This does not work if machine is not connected to internet.

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

bokeh 3.1.1 panel 1.1.0

Running it on JupyterLab 3.4.6, Python-3.9 in a Linux container. Browser: Edge 114.0

Description of expected behavior and the observed behavior

Expected behavior: DataTable is shown with full functionality. Observed Behavior: DataTaable is rendered incorrectly and is illegible.

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
pn.extension("tabulator", inline=True)
tbl = pn.widgets.Tabulator(df,   #df is already defined before
                           show_index=False,
                           sizing_mode = 'stretch_width',
                          )
tbl

Stack traceback and/or browser JavaScript console output

Failed to load resource: net::ERR_CONNECTION_CLOSED https://cdn.holoviz.org/panel/1.1.0/dist/css/loading.css loading.css:1

Failed to load resource: net::ERR_CONNECTION_CLOSED https://cdn.holoviz.org/panel/1.1.0/dist/bundled/font-awesome/css/all.min.css all.min.css:1

Failed to load resource: net::ERR_CONNECTION_CLOSED https://cdn.holoviz.org/panel/1.1.0/dist/bundled/theme/default.css default.css:1

Failed to load resource: net::ERR_CONNECTION_CLOSED https://cdn.holoviz.org/panel/1.1.0/dist/bundled/theme/native.css native.css:1

Failed to load resource: net::ERR_CONNECTION_CLOSED https://cdn.holoviz.org/panel/1.1.0/dist/bundled/datatabulator/[email protected]/dist/css/tabulator_simple.min.css tabulator_simple.min.css:1

Sometimes I get following warning in Browser console. Not sure if it is related.

Bokeh: BokehJS was loaded multiple times but one version failed to initialize.
VM227:54  Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing
(anonymous) @ VM227:54
setInterval (async)
(anonymous) @ VM227:44
(anonymous) @ VM227:63
t.attachWidget @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
t.insertWidget @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
_insertOutput @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
onModelChanged @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
m @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
l @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
e.emit @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
_onListChanged @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
m @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
l @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
e.emit @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
push @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
_add @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
add @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
_onIOPub @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
_handleIOPub @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
await in _handleIOPub (async)
handleMsg @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
_handleMessage @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
(anonymous) @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
Promise.then (async)
_onWSMessage @ jlab_core.d6bc082464b66ab0e79a.js?v=d6bc082464b66ab0e79a:2
VM228:54  Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing

sunilkr avatar Jun 23 '23 05:06 sunilkr

@philippjfr FYI ref #3013

sunilkr avatar Jun 23 '23 05:06 sunilkr

I am also facing the same issue w.r.t Tabulator. Tabulator does not get rendered properly due to unavailability of the CSS files offline.

Found In bokeh - 3.1.1 panel - 1.1.0 & 1.2.0

Browser: Chrome (114.0.5735.199) OS: Windows 10

Sample code :

import panel as pn
pn.extension("tabulator", inline=True)
table = pn.widgets.Tabulator(data_frame, sizing_mode = 'stretch_width')
table

Browser Console output:

Failed to load resource: net::ERR_NAME_NOT_RESOLVED
loading.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
widgetbox.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
listpanel.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
all.min.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
tabulator_bootstrap4.min.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
loading.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
all.min.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED
tabulator_bootstrap4.min.css:1     Failed to load resource: net::ERR_NAME_NOT_RESOLVED

naveen-mahendrakar avatar Jul 14 '23 05:07 naveen-mahendrakar

I'm also running into the same issue. It looks like the missing urls (e.g. default.css) come from importing CDN_DIST from panel.io.resources. Would it be worth dynamically setting CDN_DIST (either to point at LOCAL_DIST or the jupyterlab extension endpoint) when config.inline is set to True? Are there differences between using the jupyterlab server extension to serve files v.s. having the dependencies truly inline?

I did try setting CDN_DIST to different values as a hacky test but ran into issues with missing tabulator JS and CSS files. I'm happy to submit a PR to try and address this if it would be helpful but wanted to get input first.

gc153671 avatar Mar 21 '24 13:03 gc153671

@philippjfr I too am getting this issue when trying to render datashaded plots. Where pretty much every css file is being loaded via CDN rather than using the local dist in an offline scenario.

Files reaching out to the CDN:

  • plotly.css
  • loading.css
  • progress.css
  • native.css
  • default.css
  • listpanel.css

BranLWill avatar Jun 17 '24 17:06 BranLWill

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 09 '25 14:09 github-actions[bot]