Bokeh Server from Jupyter Notebook not activating calllbacks

Hi,

I have some code that I develop in a Jupyter notebook and then deploy in docker containers. The Jupyter code used to work fine (pre 2.3) and continues to display the (rather complex) page correctly but no longer seems to fire any callbacks (which still work with online “bokeh serve”). I am using the old (I gather) mechanism for running a server from within a notebook (see below) and have tried the mechanism referenced at bokeh/notebook_embed.ipynb at 2.3.1 · bokeh/bokeh · GitHub
but that just does nothing. I can debug that approach but is there a reason the approach shown below is no longer working/supported for callbacks?

apps = {'/': Application(FunctionHandler(make_doc))}

server = Server(apps, port=5004)
server.start()

I’d post the make_doc but it is very big. If the above is just plain deprecated then I’ll munge around with the new mechanism.

thanks

is there a reason the approach shown below is no longer working/supported for callbacks?

What you have above has never been the demonstrated method for display apps inside notebooks (which is all notebook_embed.ipynb intends to demonstrate). The earlier method looked like this:

from bokeh.application.handlers import FunctionHandler
from bokeh.application import Application

handler = FunctionHandler(bkapp)
app = Application(handler)

and still works just fine with Bokeh 2.3.1:

We don’t highlight this method anymore just because it’s unnecessarily verbose, requiring several extra imports.

However your question is somewhat unclear. Are you asking running Bokeh applications that are run inside the notebook, but viewed outside the notebook?

If so, we’ve never demonstrated that anywhere in any docs or examples, and I’ve never personally advised anyone about doing that that I can recall. There’s not any particular reason I can imagine it would not work, but it’s also not possible to speculate without a Minimal Reproducible Example

FWIW your code above also works fine for me locally, viewing from a different browser.

More information (platform, browser, JS console logs, docker logs, docker config, an MRE… ideally just a repo to clone and quickly try) is definitely needed.

Bryan

The way I have been using that code is to run the server inside the notebook and open another browser tab (localhost:5004) and view the output. This still displays the page/tabs/plots/maps but no callbacks to the server are firing any more. I will look to get a minimal example up to demonstrate - fwiw the docker, etc reference is not relevant to this issue - it is a pure local Jupyter issue.

thanks for the quick response

1 Like