holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.13k stars 108 forks source link

ipwidgets can quietly fail if wrapped in an hvPlot component #943

Open droumis opened 2 years ago

droumis commented 2 years ago

Description of expected behavior and the observed behavior

ipwidgets can quietly fail if wrapped in an hvPlot component. There should be some error/warning.

The issue seems to occur if you install JupyterLab in a different environment than the IPython kernel that is being used to run a notebook. The ipywidgets docs have a fix for this (See also this issue).

users should be warned in some way if the ipywidgets are not working. Ideally, there would be a warnings about this issue in the hvplot documentation as well as inline in a notebook when the issue occurs.

Complete, minimal, self-contained example code that reproduces the issue

Here is a section extracted from the hvplot user guide / interactive.ipynb. It produces no output as seen in the screenshot underneath the code

import ipywidgets as ipw
import hvplot.xarray # noqa
import xarray as xr

ds = xr.tutorial.load_dataset('air_temperature')
slider = ipw.IntSlider(description='time', min=0, max=10)
ds.air.interactive(width=800).isel(time=slider)

image

Stack traceback and/or browser JavaScript console output

You can see the error if you simply try to render the ipywidget

import ipywidgets as ipw
slider = ipw.IntSlider(min=0, max=10)
slider
Error displaying widget: model not found

image

maximlt commented 2 years ago

Let's first document that, it's going to be easy to link to this page. I don't know how hard it'd be though to emit a warning to the user, so I consider that something nice to have!