Using Bokeh from Server with confidential data

Hi there,

I am working on a server with confidential data and would like to use bokeh. I am not allowed to push the data to the bokeh server. Can I use the jupyter Notebook Version of bokeh without connecting to the server?

Also,after importing the package (from bokeh.io import output_notebook, show) and calling the command output_notebook, the bokeh icon does not load, but the message: Loading Bokeh… persists.

What is the Problem here?

Thank you and best regards,
Britta

I am working on a server with confidential data and would like to use bokeh. I am not allowed to push the data to the bokeh server. Can I use the jupyter Notebook Version of bokeh without connecting to the server?

Certainly, if you pass plain Bokeh objects (e.g. plots, layouts) to show, that just renders output using the BokehJS library only, without invoking the server. For the server to come in to play, you have to pass a Python function to show (often called modify_doc by convention, you can see that in the examples). You should of course be aware that all the data has to be sent from the Jupyter kernel process to the browser process, either way. If the data is in Numpy arrays, it will be base64 encoded, but it has to be sent there nonetheless, so that BokehJS knows what to draw. If the data is in plain lists, or is of a type that doesn’t map to a JavaScript Typed Array type, then it will just be JSON encoded. You must understand that all the work and drawing is done by the BokehJS JavaScript library, using that actual data to render on to an HTML cavas. It is not the case, e.g. that Bokeh just generates a static image in the Python process, so that an image is all that hits the browser process. If you save a plot as HTML, or if you nbconvert a notebook, all that data will remain in the output, as data.

If you want static image output, you can generate PNGs. You should be aware in that case that all the data must be sent to a separate PhantomJS process so that BokehJS can render the data in a specially instrumented headless browser in order to generate and save out the PNGs.

It’s worth mentioning in passing: when you embed a Bokeh server app in a notebook (specifically in the notebook case), all that actually does is add some coroutines to the existing Jupyter kernal IOLoop. So “pushing to the server” is a bit misleading since all the data remains in the same Jupyter kernel process where it began. (It gets sent via websocket to from one part of the same process to another) In any case the server routines are not started unless you ask them to be started by passing a modify_doc function to show.

the bokeh icon does not load, but the message: Loading Bokeh… persists. What is the Problem here?

You are on an airgapped network? Or behind a very restrictive firewall? That icon is loaded from a bokeh.org website, even when “inline” BokehJS resources are used. You can pass the argument hide_banner=True to output_notebook if you just want to hide the standard output message and logo altogether.