holoviz / holoviz/hvplot

ipwidgets can quietly fail if wrapped in an hvPlot component

Open
#943 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### 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](https://ipywidgets.readthedocs.io/en/stable/user_install.html#:~:text=If%20JupyterLab%20and%20the%20IPython%20kernel%20are%20installed%20in%20different%20environments%20(for%20example%2C%20separate%20environments%20are%20providing%20different%20Python%20kernels)%2C%20then%20the%20installation%20requires%20two%20steps%3A) (See also [this issue](https://github.com/matplotlib/ipympl/issues/112)).

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](https://user-images.githubusercontent.com/6613202/195809369-804399da-43c9-4359-a360-767b4a77e5ff.png)

#### Stack traceback and/or browser JavaScript console output

You can see the error if you simply try to render the ipywidget
``` python
import ipywidgets as ipw
slider = ipw.IntSlider(min=0, max=10)
slider
```
``` bash
Error displaying widget: model not found
```
![image](https://user-images.githubusercontent.com/6613202/195807174-804059fa-11e4-44c6-94cc-205078c8ca1a.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.