How to run Panel with external IP, or why 'Preview with Panel' works, but `panel serve` shows empty Matplotlib panel

Hello!

I am working on a remote computer, where I log into with SSH (and which is available only via company VPN).

I tried running the example from Build an App — Panel v1.5.2 with panel serve --address=<IP> --port=5006 --allow-websocket-origin=<IP>:5006 --dev notebook.ipynb, and it runs without any problems, and work correctly.

However, when I tried to do the same with the matplotlib example from Matplotlib — Panel v1.5.2 (without any changes, downloaded from https://raw.githubusercontent.com/holoviz/panel/main/examples/reference/panes/Matplotlib.ipynb with wget), I get quite strange behavior.

  1. When I click on ‘Preview with Panel’ button, I get almost empty page - however, when I created a simpler notebook based on the Matplotlib.iynb one, but with pn.template.EditableTemplate([...]).serverable(), everything renders correctly
  2. When I run Panel from the terminal with panel serve --address=<IP> --port=5006 --allow-websocket-origin=<IP>:5006 --dev <notebook>.ipynb, I always get almost empty page.

The panel serve ... command does not show any errors or warnings:

$ panel serve --address=<IP> --port=5006 --allow-websocket-origin=<IP>:5006 --dev Matplotlib.ipynb
2024-10-15 13:29:21,976 Starting Bokeh server version 3.6.0 (running on Tornado 6.4.1)
2024-10-15 13:29:21,977 User authentication hooks NOT provided (default user enabled)
2024-10-15 13:29:21,978 Bokeh app running at: http://<IP>:5006/Matplotlib
2024-10-15 13:29:21,979 Starting Bokeh server with process id: 2373293
2024-10-15 13:29:51,279 WebSocket connection opened
2024-10-15 13:29:51,279 ServerConnection created
2024-10-15 13:29:59,477 404 GET /sm/a66f7e8440d7b0538d7c7e64fb20eaeb1b8e7204179c205d57a779774b7b22d9.map (172.18.56.66) 0.70ms

When I inspect the almost empty page from panel serve ... I see the following problems and errors:

  • attempt at accessing the localhost (127.0.0.1), even though I have provided the --allow-websocket-origin parameter (question: is there parameter that I should have provided in addition)?

    (3)(+0002033): Error: HTTP request to http://127.0.0.1:23119/connector/ping rejected with status 0
    
  • Muuri being not defined

    Uncaught ReferenceError: Muuri is not defined
    at Matplotlib:311:16
    
  • undefined value error that is most probably caused by the previous error:

    bokeh.min.js?v=de958…62521f0895deb32:164 Error rendering Bokeh items: TypeError: Cannot read properties of undefined (reading 'on')
        at eval (eval at _render_script (panel.min.js?v=03554…3f4c6edba4:225:6767), <anonymous>:36:6)
        at M.run_script (panel.min.js?v=03554…3f4c6edba4:225:2895)
        at M.render (panel.min.js?v=03554…3f4c6edba4:225:3719)
        at M.render_to (bokeh.min.js?v=de958…1f0895deb32:223:512)
        at M.build (bokeh.min.js?v=de958…1f0895deb32:223:830)
        at bokeh.min.js?v=de958…1f0895deb32:220:320
        at async l (bokeh.min.js?v=de958…1f0895deb32:220:198)
        at async bokeh.min.js?v=de958…1f0895deb32:220:408
        at async k (bokeh.min.js?v=de958…f0895deb32:164:1098)
    k	@	bokeh.min.js?v=de958…62521f0895deb32:164
    

From what I found, Muuri is a JavaScript library to create responsive, sortable, filterable and draggable layouts.

Why it is not a problem for hvPlot, but is a problem for Matplotlib? Why it (sometimes) works with ‘Preview with Panel’, but not with panel serve --address?

How can I try to solve this problem? Is there some command line argument that I should have provided, or perhaps some configuration option?

List of relevant packages installed:

  • bokeh==3.6.0
  • holoviews==1.19.1
  • hvplot==0.11.0
  • ipykernel==6.29.5
  • ipympl==0.9.4
  • ipython==8.27.0
  • ipython-genutils==0.2.0
  • ipywidgets==8.1.5
  • ipywidgets_bokeh==1.6.0
  • jupyter-events==0.10.0
  • jupyter-lsp==2.2.5
  • jupyter-server-mathjax==0.2.6
  • jupyter_client==8.6.3
  • jupyter_core==5.7.2
  • jupyter_server==2.14.2
  • jupyter_server_terminals==0.5.3
  • jupyterlab==4.2.5
  • jupyterlab_pygments==0.3.0
  • jupyterlab_server==2.27.3
  • jupyterlab_widgets==3.0.13
  • matplotlib==3.9.2
  • matplotlib-inline==0.1.7
  • panel==1.5.2
  • pyviz_comms==3.0.3
  • watchfiles==0.24.0

Not sure, but I think you could report this on GitHub issues. Thanks!