Bokeh and Binder issues

I am working on a “skill scalable” data pipeline and it was working great in Binder, but now after some updates on their end the plots are not working

Population Density

So far they work by switching from notebooks to lab but are super glitchy by alternating back and forth between notebook and then lab.

I posted on Binder as well Binder Discourse

I got a deadline for edits on a peer reviewed paper related to this so I am desperate to get it fixed.

@tpike3 I am afraid your description is fairly vague. I tried looking at the notebook but I am not really sure what I am looking at or how it is intended to be used. As best I can tell there is some data that has not been loaded? But I have no idea how or where it should be loaded. If there is a Binder issue, then unfortunately I don’t know how much help we could be directly, as we have no control or input over the Binder implementation or deployment. That said, I did just check the Bokeh tutorial notebooks on Binder and they are working/displaying correctly as expected. In any case, maybe you can describe your issue in significantly more detail.

@Bryan The issue is the plots are not displaying inline and I couldn’t find a comparable example in the bokeh binder tutorials to address this issue. As the only interactive one I saw it pulling form a website.

In step 3 it should show a heatmap of the population density of Albania with the ability to change the size and title.

In step 6 it overlays a box on the map and the slider widget allow users to narrow their choice to a smaller area.

The data is there in both binder and locally per these three tests:

  1. If you run in jupyter locally it works
  2. Oddly if you convert to jupyterlab or start in jupyterlab and convert to notebook the plot appears.
  3. Also if you use method output_file() instead of output_notebook() the plot displays.

I am assuming there is some parameter I can adjust for this but can’t figure it out I am starting to look through the source code but haven’t figure it out yet.

You might try completely clearing your cache. Also try other computers, browsers, private mode, etc. There potentially seem to be some intermittent interactions between JS caching and notebooks specifically. Purely speculation at this point in this case, but it’s hard to say anything concrete without more information.

I also just want to make sure I understand: Your goal is to have classic notebooks on binder? Or jupyterlab notebooks? Or either/both? AFAIK Binder has switched to jupyterlab by default and I would recommend just sticking with that, as the best-supported option on both Binder and Bokeh. Classic notebook is surely finally starting to approach its sunset.

Also, just to be clear, I stll have no idea how to reproduce because I have no idea how to load the data it seems to want:

Ahhh Dang sorry I copied the wrong link…here is the one you want Binder

This one has embedded data.

Right now it uses notebook, but we will refactor to create a similar approach with jupyterlab. However, my immediate concern is to make it work for the peer review.

The larger project effort is here:

and a similar here

@tpike3 I am not sure how or why your notebooks are doing this, but this is 100% the problem:

image

The Python and JS versions absolutely have to match. But I am not sure what your notebook could be doing to even cause this. As the quickest possible thing to try as a workaround: downgrade to Python package Bokeh 2.3.0

As an aside I have to be honest and say that the notebook with show/hide and “run” buttons is incredibly confusing to me, as someone who just expects to hit <shift>-<enter> to execute cells. It’s already hard enough to reason about execution order and state in “normal” notebooks and this just exacerbates that by removing the Out[4] etc that shows which cells have been executed, and when. But also, I have no idea if that is also contributing somehow to your issue.

@Bryan thanks, I will work to resolve! Interestingly I have no issues like this on my local machine it is only with the binder upgrade and it goes away switching back and forth between notebook and lab.

As far as the notebook, I will not disagree this set up is glitchy. The intent is a prototype skill scalable pipeline that allows non-coders to explore without coding, while allowing coders to explore at multiple levels. Ideally as we transition it jupyterlab we make more intuitive for both users.

@tpike3 Another idea: if the actual notebook files that are in GitHub have been previously executed with Bokeh 2.3 and saved with content in output cells, but then the Binder env installs Bokeh 2.4 that might explain this scenario. Generally speaking (IMO), notebooks for Binder should be stored unexecuted with all output cells cleared. If you need to save executed notebooks with output cells then you will need to make sure the Binder env installs a matching Bokeh version to whatever the notebooks were executed and saved with.

@Bryan that was it, if I specify bokeh 2.3 in Binder it works and if I upgrade to bokeh 2.4 on my local machine it also stops displaying.

2 Likes