I’m trying to run one of the examples from http://holoviews.org/user_guide/Deploying_Bokeh_Apps.html on my Windows 10 laptop:
# panel_test/main.py import holoviews as hv import panel as pn import numpy as np hv.extension('bokeh') def sine(frequency, phase, amplitude): xs = np.linspace(0, np.pi*4) return hv.Curve((xs, np.sin(frequency*xs+phase)*amplitude)).options(width=800) if __name__ == '__main__': ranges = dict(frequency=(1, 5), phase=(-np.pi, np.pi), amplitude=(-2, 2), y=(-2, 2)) dmap = hv.DynamicMap(sine, kdims=['frequency', 'phase', 'amplitude']).redim.range(**ranges) pn.serve(dmap, port=5006, allow_websocket_origin=["localhost:5000"], show=False)
This should be a self contained, easy to reproduce example. I have a new environment that I created with:
conda create --name bokeh python=3.9 holoviews=1.14.2 bokeh=2.3 conda activate bokeh
I run the bokeh server with:
panel serve --allow-websocket-origin=localhost:5006 --show panel_test
The result is an empty page in chrome, with the “Uncaught Error: Cannot find module ‘@bokehjs/styles/buttons’” error in console:
The cli output looks okay, but maybe it’s useful:
2021-04-05 18:35:34,780 Starting Bokeh server version 2.3.0 (running on Tornado 6.1) 2021-04-05 18:35:34,781 User authentication hooks NOT provided (default user enabled) 2021-04-05 18:35:34,787 Bokeh app running at: http://localhost:5006/panel_test 2021-04-05 18:35:34,787 Starting Bokeh server with process id: 18784 2021-04-05 18:35:36,352 WebSocket connection opened 2021-04-05 18:35:36,353 ServerConnection created
I’ve tried many examples with serve and all of them give the exact same error. What’s curious that searching in Google for the error between "s gives zero results: https://www.google.com/search?q=“pn.serve”+“Uncaught+Error%3A+Cannot+find+module”+"%40bokehjs%2Fstyles%2Fbuttons"
Meanwhile if I try any of the examples that use the curdoc() approach instead of pn.serve (like the last example on the same Deploying Bokeh Apps page, that I don’t include here as it’s pretty long), it works without problems.
Now I’m curious why this is happening and how I could resolve it. I’ve read through all of the deployment documentations of Holoviews, Bokeh and Panel, but I assume I don’t understand something. I tried to run the same script with “python panel_test/main.py” assuming that maybe if serve is called within the script I don’t have to call it from cli, but got the same chrome console error and some more, so yeah, I am definitely missing something.
Any help is appreciated.