Loading Bokeh on jupyterHub in pyspark kernel


I have deployed a AWS EMR (cluster) with jupyterhub pre-packaged by AWS.
in this context I am trying to load bokeh as my plotting library.
I followed the documentation but still did not manage to see any bokeh output.

I notice that the documentation about jupyterhub is rather fragmented. would it be possible to get a full A to Z example?

on my last trial, when i run


I get the error

An error was encountered:
Object of type Undefined is not JSON serializable


I’m not aware of any one that exists. I’ve never personally used jupyter hub so I can’t really offer any direct advice. But for anyone to even begin to speculate you’d need to provide more information: all relevant package versions, any error messages from the browser’s javascript console log, juyterhub process log, etc.

Let me add some details on this issue

I am runing AWS EMR 6.3.0 that is runing on Amazon Linux 2 AMI, bundled with:

  • Hadoop 3.2.1
  • Python 3.7.9
  • Java 1.8.0
  • Spark 3.1.1
  • Scala 2.12.10
  • JupyterHub 1.2.0
  • Ganglia 3.7.2
  • Livy 0.7.0

On this machine I install hail v0.2.74, that come with bokeh 1.4.0
From there I connect to the JupyterHub and creat a new notebook using Pyspark kernel.

In the note I try to load bokeh

from bokeh.io import show, output_notebook

That trigger an error An error was encountered: No module named 'IPython'

I installed IPython sudo python3 -m pip install ipython

At that point when I run the block above to load bokeh, I do not get error, but I also do not get any output (expecting to see “Bokehjs successfully loaded” prompt")

I noticed that the documentation of bokeh advise to install jupyter-bokeh
I run sudo python3 -m pip install jupyter_bokeh.

At this point bokeh is updated to 2.3.3
When I run the block above to load bokeh I fot a different error: An error was encountered: Object of type Undefined is not JSON serializable

This is where I am and don’t know what else to do…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.