How to make the Dashboards example work on Google Colabs?

I downloaded the notebook from the http://holoviews.org/user_guide/Dashboards.html example page and uploaded to Google Colabs:
https://colab.research.google.com/drive/1s7zVjWeUsXP5Dsm-L8F1steiOuYNgZVe?usp=sharing

I did not change much other than

  1. Installed holoviews and datashader
  2. downloaded the bokeh sample data as instructed by the error message after the first run
  3. added hv.extension to every cell as Colab needs that
  4. added bokeh.io.output_notebook() to see if it helps (it doesn’t)

The problem is the interactive features don’t work in any of the examples. The charts show up, I have the input elements, but nothing changes on input.

Some times there are no errors in the console, other times one of these two shows up:

  • Uncaught (in promise) Error: Expected text fragment but received binary fragment
  • Uncaught (in promise) TypeError: e is not iterable at Function._instantiate_references_json

Anybody has an idea what’s happening and how to solve it? Thanks!

Assuming there is an incompatibility issue here, are there any other similar notebook services that make it easy to share notebooks and let others try them on the spot while being compatible with Holoviz? One of the main reasons Colab is a core part of my workflow because it makes sharing my workflow to colleagues, clients or strangers easy, so they can immediately reproduce the exact same results and experiment with the code on the spot.

I love Holoviz so far, but I spent an enormous amount of time trying to find out why stuff doesn’t work, only to realize this is some incompatibility with Colab. So I’m considering replacing Colab, but I need something then that has some of its functionality:

  • Some fork of Jupyter Notebook
  • Being able to install python modules with specific version through pip/conda
  • Can share the notebook through a link. It can be executed by the visitor and a copy can be made to edit and execute.
  • There should be a free package available with a few-clicks registration. I’m more than happy to pay for the service, but the whole point is to let others quickly try what I shared and they are not going to throw their credit cards at it immediately.

My current use case is a tutorial. An article is going to be published on Medium with the raw code and it needs an executable live demo, so a notebook is going to be linked to let the readers follow every steps. Google Colab is ideal for that, and it works fine, until I get to the dasboarding part where it just doesn’t refresh at all. (That’s why I checked, and indeed, the Holoviews Dashboards example works on my local environment, but it doesn’t on Colab, so it’s not about my code.)

I can not use Binder and as there is no way for the readers to make a copy there and experiment with it, and I also can not just run a Jupyter Lab on a server and share that publicly to let everybody edit the original notebook… Microsoft had Azure Notebooks, but they just shut it down. Cocalcs free plan doesn’t allow installing packages or downloading datasets, so my shared notebook wouldn’t run for the newly signed up readers. I’m going to check out IBM Watson, but as far as I remember, the registration there is way more difficult then what anybody can be expected to do just to see an illustration to an article.

Does anybody have any recommendation?

Hi @SteveAKopias

I feel your love and pain :slight_smile:

My ideas would be

  1. There is a question + answer on stack overflow How to make the Holoviews show graph on Google Colaboratory notebook? - Stack Overflow. You could try that out.

image

  • If you cannot get it working you should file a bug report to get it fixed.
  • If you think the HoloViews documentation should be improved then a feature request.
  • If you think Google Colab should support this better then you could file a feature request on their github.
  1. I know Panel supports a special initialization pn.extension(comms='colab') to work in colab or alternatively that the pn.extension() is run in each cell. See https://panel.holoviz.org/

You could try to experiment with that as well or provide a PR to HoloViews based on that code.

  1. If you expose your example as a Panel app you could potentially get it hosted at PyViz Topics Examples — Examples 0.1.0 documentation or Awesome Panel (awesome-panel.org).

I use binder my self and aside from the loading time it works great I belive. Check out the binder links at

Thanks a lot for the recommendations, but I’ve already tried those. Based on some issues and release notes on github, the %env is not necessary anymore (I still tried), and I have hv.extension in every cell.

The issue is even more mysterious, as usually the code doesn’t work, but sometimes if I re-run the same cell, it starts to work after a few click.

There is an old issue on the Colab Github where a Colab contributor talks about the same error message from an only occasionally reproducible error, so I jumped in there to see if that will lead anywhere. I’m usually a bit vary posting a bug report until I’m not 99% sure the bug is not actually me not understanding something, but even if it’s real this time, I think nobody knows if it’s on the Colab side or in which one of the Holoviz modules…

Also, thanks for the offer to host some example at the awesome-panel website. Usually I can host my stuff for myself, so that’s not the issue here with the sharable notebooks. But I like what you are doing with the project, so if I ever have something that could be a contribution to that, I’ll take you up on than offer!

1 Like