How To: Use Jupyter Bokeh in Data Lab
Overview
If a JavaScript error occurs while attempting to display Bokeh content, it could be due to an error in downloading Bokeh's client library.
To resolve this issue, the solution involves defining the resources as INLINE in the output_notebook()
call. By specifying the resources as INLINE, the necessary Bokeh client library will be included directly in the notebook, eliminating any potential errors related to downloading the library.
The subsequent sections provide the code snippet and instructions to implement the solution and ensure the proper display of Bokeh content in Jupyter notebooks.
Solution
To resolve the JavaScript error associated with downloading Bokeh's client library, follow these steps:
Import the necessary module
INLINE
frombokeh.resources
.Use the
output_notebook()
function to configure the Bokeh output to be displayed in the Jupyter notebook. Pass theresources
parameter and set it toINLINE
. This ensures that the required Bokeh client library is included directly in the notebook.
The following code snippet demonstrates the implementation of the solution:
from bokeh.resources import INLINE
output_notebook(resources=INLINE)