holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

KeyError: 'factors' when running Streaming.ipynb notebook

Open MarcSkovMadsen opened this issue 1 year ago • 2 comments

I'm trying to run the Streaming.ipynb notebook on the current hvPlot master branch but cannot.

image

ERROR:tornado.application:Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <zmq.eventloop.ioloop.ZMQIOLoop object at 0x7fb0680be9d0>>, <Task finished name='Task-4' coro=<PeriodicDataFrame._cb() done, defined at /opt/conda/lib/python3.9/site-packages/streamz/dataframe/core.py:1046> exception=KeyError('factors')>)
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/tornado/ioloop.py", line 741, in _run_callback
    ret = callback()
  File "/opt/conda/lib/python3.9/site-packages/tornado/ioloop.py", line 765, in _discard_future_result
    future.result()
  File "/opt/conda/lib/python3.9/site-packages/streamz/dataframe/core.py", line 1052, in _cb
    await asyncio.gather(*source._emit(dict(last=last, now=now)))
  File "/opt/conda/lib/python3.9/site-packages/streamz/core.py", line 449, in _emit
    r = downstream.update(x, who=self, metadata=metadata)
  File "/opt/conda/lib/python3.9/site-packages/streamz/core.py", line 715, in update
    return self._emit(result, metadata=metadata)
  File "/opt/conda/lib/python3.9/site-packages/streamz/core.py", line 449, in _emit
    r = downstream.update(x, who=self, metadata=metadata)
  File "/opt/conda/lib/python3.9/site-packages/streamz/sinks.py", line 69, in update
    result = self.func(x, *self.args, **self.kwargs)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/streams.py", line 492, in send
    self.event(data=data)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/streams.py", line 430, in event
    self.trigger([self])
  File "/opt/conda/lib/python3.9/site-packages/holoviews/streams.py", line 186, in trigger
    subscriber(**dict(union))
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 253, in refresh
    raise e
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 249, in refresh
    self._trigger_refresh(stream_key)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 266, in _trigger_refresh
    self.update(key)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 995, in update
    item = self.__getitem__(key)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 455, in __getitem__
    self.update_frame(frame)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/bokeh/element.py", line 1535, in update_frame
    ranges = self.compute_ranges(self.hmap, key, ranges)
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 647, in compute_ranges
    self._compute_group_range(group, elements, ranges, framewise,
  File "/opt/conda/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 898, in _compute_group_range
    filtered = [r for i, r in zip(ids, values[g]) if i not in prev_ids]
KeyError: 'factors'

holoviews==1.15.0, tornado==6.1 Streams==0.6.4

MarcSkovMadsen avatar Aug 28 '22 06:08 MarcSkovMadsen

I see the same problem, but it seems like streamz.DataFrames are fundamentally broken right now (at least in notebook).

Fullpath to the example in hvplot/examples/user_guide/Streaming.ipynb

hoxbro avatar Aug 29 '22 15:08 hoxbro

Just to double check, this is being filed on holoviews rather than hvplot even though it arises with hvplot, because we think it's a problem that would be addressed at the holoviews (or streamz) level, not hvplot? If so, sounds good.

jbednar avatar Aug 29 '22 22:08 jbednar