Search code examples
linuxvisualizationbokehjupyter-lab

Why does running bokeh in jupyter-lab require outbound network access?


I have an outbound interface, and want to run jupyter-lab with bokeh. When this interface is not enabled, the cell that has to show the plot runs but nothing gets rendered. I have to turn on the interface, before bokeh displays the chart.

Is there a way to disable this behaviour?


Solution

  • Most of the actual work of Bokeh is performed by a JavaScript library, BokehJS. And like many JavaScript libraries, it is primarily loaded from a remote CDN, in this case cdn.bokeh.org. However, it is possible pass INLINE resources to output_notebook, in which case Bokeh will embed BokehJS directly in the notebook output cells, rather than loading it from CDN. Please be aware that this will cause the notebook size to increase by a few megabytes, and additionally that you will lose any of the benefits afforded by built-in browser caching of scripts.