Trying to port application to 1.1.1, but almost nothing works anymore


I’ve been spending most of the day trying to port my application to latest and greatest holoviz.
I had to disable WebGL for Holoviews, install Bokeh 3.2 to avoid tons of “DeserializationError” errors. I had to put all extensions used in 1 single pn.extensions() call.
Currently, buttons almost never work in my applicaiton. I see that there is some sort of websocket activity, but nothing happens in browser console, nothing happens in VS Code log.

If I run the widget button example it always seems to work:

import panel as pn

button = pn.widgets.Button(name='Click me', button_type='primary')

text = pn.widgets.TextInput(value='Ready')

def b(event):
    text.value = 'Clicked {0} times'.format(button.clicks)
pn.Row(button, text).servable()

However, if I add this to my application somewhere, it sometimes works. When it does not, there are however no errors to be seen anywhere.

Panel Server running on following versions:

Python 3.10.10Panel: 1.1.1Bokeh: 3.2.0Param: 1.13.0

Log when starting:
python -m panel serve src/web_server/ src/web_server/ src/web_server/ --warm --admin --profiler snakeviz
2023-06-28 15:39:43,193 W-1005 (FIXED_SIZING_MODE): ‘fixed’ sizing mode requires width and height to be set: figure(id=‘p1113’, …)
2023-06-28 15:39:43,195 W-1005 (FIXED_SIZING_MODE): ‘fixed’ sizing mode requires width and height to be set: figure(id=‘p1071’, …)
2023-06-28 15:39:43,195 W-1005 (FIXED_SIZING_MODE): ‘fixed’ sizing mode requires width and height to be set: figure(id=‘p1016’, …)
2023-06-28 15:39:43,215 W-1005 (FIXED_SIZING_MODE): ‘fixed’ sizing mode requires width and height to be set: figure(id=‘p1361’, …)
2023-06-28 15:39:44,002 Starting Bokeh server version 3.2.0 (running on Tornado 6.2)
2023-06-28 15:39:44,003 User authentication hooks NOT provided (default user enabled)
2023-06-28 15:39:44,007 Bokeh app running at: http://localhost:5006/assay
2023-06-28 15:39:44,008 Bokeh app running at: http://localhost:5006/camera_image
2023-06-28 15:39:44,008 Bokeh app running at: http://localhost:5006/dashboard
2023-06-28 15:39:44,008 Starting Bokeh server with process id: 6328
2023-06-28 15:39:44,666 WebSocket connection opened
2023-06-28 15:39:44,668 ServerConnection created

I understand that this is not much to work with. Has anyone else had similar trouble with getting very basic stuff working after upgrading?

Hi @Wiggan

Things to try

  • Hard refresh you browser
  • Try the simplest possible example (as you have done)
  • Follow the Upgrade Guide
  • Provide more information in this discourse chat like screenshots or videos. We need to understand “Not working” better. What do you see and not see? Have you checked server logs? Have you checked browser console logs?

These are indeed very frustrating but should not cause any real issues.

I had to put all extensions used in 1 single pn.extensions() call.

This definitely should not be the case. I’m trying to reproduce now.

However, if I add this to my application somewhere, it sometimes works.

It would be really, really helpful if you could provide an minimal example where things don’t work.

Hard refresh sounds like a good idea! Although I did install firefox just to test it in another browser…
I was in a rush when posting, sorry about that. I will try and provide more details.

A typical symptom for buttons, regardless of implementation (on_click, param.Action etc) is that I can see the spinning wheel up to the right, indicating websocket activity (IIRC), but the callback function for the button is never called.

I hosted the application with panel serve --autoreload --log-level=trace, but nothing happens at all in the log when I press buttons.

The randomness I observer seems to be related to the --autoreload flag after some more testing!
It seems to consistently not work at all when I do serve --autoreload, but things are responsive if I remove it.I cannot reproduce this with serving the button example with --autoreload.

I will continue testing and try to be more precise about my findings. (812 Bytes) (332 Bytes)
Could not attach a zip-file, but if these guys are placed in a folder called tests and run with:
python -m panel serve tests/ --autoreload
The behavior I get is that in first tab, the button does nothing. In the second tab it works. If run without --reload both work.

Would be very interesting to see if you get the same behavior.

Another new issue is loading time.
I have this bundle of UX joy:

So it’s a hvplot, lost of buttons, some sliders. It takes ~15s to load now. It took 1-2s in 0.14.
I’ll try and remove stuff and find what’s causing this increase.

This seems to be a bit random. Sometimes it loads faster. When it takes lots of time, it seems to coincide with these bokeh 3.1.1 problems:

bokeh.core.serialization.DeserializationError: can't resolve reference 'p6619'
2023-06-29 11:13:35,818 error handling message
 message: Message 'PATCH-DOC' content: {'events': [{'kind': 'ModelChanged', 'model': {'id': 'p6638'}, 'attr': 'value_throttled', 'new': 0}]}
 error: DeserializationError("can't resolve reference 'p6638'")
Traceback (most recent call last):

serve --warm also seems to cause the unresponsive behavior.

Perfect, thanks for all that detail. I’ll investigate and get back to you.

If there’s any chance you could share that I’d love to do some profiling with that.

Putting components in the global namespace of an imported module is definitely a slightly weird pattern. I’ll resolve the issue with --warm and --autoreload as I can see what’s causing it. Just want to note that since the module is reused between all sessions the component state will be shared across sessions, which seems generally undesirable (except for very specific cases).

Mine is a weird use case for Panel, because the application represents one physical instrument. So regardless of who loads up the application, they should see the same state of things.

I think the ux wonder actually is very decoupled from the rest of the application, so I should be able to extract that part for you. It did seem like it was related to bokeh 3.1.1 exceptions, but I’m not 100% sure.

That’s a perfect use of that pattern then.