hvplot.interactive stops working and raises errors
MarcSkovMadsen opened this issue · 2 comments
Panel: 0.12.6, Bokeh: 2.2.4, hvplot: 0.7.3, holoviews: 1.14.7
In #695 I noted that hvplot.interactive
does not seem to output nicely to a responsive hvplot. I can now see that it does not matter whether responsive or not.
I've attached a reproducible notebook.
As you can see the plot only updates the first time its dragged.
As you can see I can also trigger an exception sometimes.
hvplot_interactive_crashes_in_notebook.mp4
The consequence is that hvplot.interactive
is not useful currently. Sophia and I are in the process of releasing a blog post on hvplot interactive. I guess it would not make sense to post before this is solved.
Notebook
Rename from .csv
to .ipynb
.
hvplot_interactive_not_working.csv
Exception
I cannot provide steps to exactly reproduce. But try clicking the buttons and dragging the slider. You might also have to rerun the cell with the interactive hvplot a couple of times.
Traceback (most recent call last):
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\pyviz_comms\__init__.py", line 325, in _handle_msg
self._on_msg(msg)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\panel\viewable.py", line 273, in _on_msg
doc.unhold()
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\bokeh\document\document.py", line 799, in unhold
self.callbacks.unhold()
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\bokeh\document\callbacks.py", line 396, in unhold
self.trigger_on_change(event)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\bokeh\document\callbacks.py", line 373, in trigger_on_change
invoke_with_curdoc(doc, event.callback_invoker)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\bokeh\document\callbacks.py", line 408, in invoke_with_curdoc
return f()
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\bokeh\util\callback_manager.py", line 191, in invoke
callback(attr, old, new)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\panel\reactive.py", line 302, in _comm_change
self._process_events({attr: new})
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\panel\reactive.py", line 263, in _process_events
self.param.set_param(**self_events)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\param\parameterized.py", line 1904, in set_param
return self_.update(kwargs)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\param\parameterized.py", line 1877, in update
self_._batch_call_watchers()
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\param\parameterized.py", line 2038, in _batch_call_watchers
self_._execute_watcher(watcher, events)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\param\parameterized.py", line 2000, in _execute_watcher
watcher.fn(*args, **kwargs)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\streams.py", line 757, in _watcher
self.trigger([self])
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\streams.py", line 186, in trigger
subscriber(**dict(union))
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 250, in refresh
raise e
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 246, in refresh
self._trigger_refresh(stream_key)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 263, in _trigger_refresh
self.update(key)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 992, in update
item = self.__getitem__(key)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 452, in __getitem__
self.update_frame(frame)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\bokeh\element.py", line 2438, in update_frame
self._update_ranges(element, ranges)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\bokeh\element.py", line 813, in _update_ranges
l, b, r, t = self.get_extents(element, ranges)
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 1879, in get_extents
xpad, ypad, zpad = self.get_padding(overlay, (x0, y0, z0, x1, y1, z1))
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 1332, in get_padding
opts = self._traverse_options(
File "C:\Users\masma\Anaconda3\envs\hvplot_interactive\lib\site-packages\holoviews\plotting\plot.py", line 962, in _traverse_options
return options if keyfn else options[None]
KeyError: None
I also see this issue. The panel served notebook looks fine. The bug seems to happen in the notebook with the slider.
This can be recreated with:
import hvplot.pandas
import pandas as pd
import panel as pn
df = pd.DataFrame({"a": [0], "b": [0]})
idf = df.interactive()
slider_a = pn.widgets.IntSlider(start=0, end=1)
ipipeline = idf[idf.a == slider_a]
ipipeline.hvplot(by="a")