holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.79k stars 518 forks source link

Intermittent TypeError in Panel Dashboard #6644

Open bt- opened 7 months ago

bt- commented 7 months ago

I posted a question about this error on the Discourse page and was asked to open this issue report.

I’ve created a panel dashboard that works well, but occasionally raises a TypeError that doesn’t seem to affect the dashboard functioning but does stack up long error messages. I’m able to work around the issues by setting pn.config.console_output = 'disable'. The error doesn’t seem to affect the output, so that is a fix, but I’d like to understand why the error is occurring and more importantly how to debug it.

The code to produce the dashboard is available here 1. This plot function creates a dashboard with three tabs to plot timeseries curves. The error occurs most often when selecting or un-selecting columns or groups of column identifiers on the third tab, which is used to create custom overlays of curves:

Screenshot from 2024-02-28 13-38-27

The error is intermittent. I can use the panel dashboard and it works fine most of the time. I have not found a series of selecint / un-selecting elements to plot that reliably reproduces the error.

ALL software version info

Firefox: 106.0.1 (64 bit) panel 1.2.1 py311h06a4308_0 bokeh 3.2.1 py311h92b7b1e_0 holoviews 1.17.0 py311h06a4308_0 hvplot 0.8.4 pyhd8ed1ab_1 conda-forge colorcet 3.0.1 py311h06a4308_0

commit : 0f437949513225922d851e9581723d82120684a6 python : 3.11.4.final.0 python-bits : 64 OS : Linux, POP!_OS 22.04 OS-release : 6.0.2-76060002-generic Version : #202210150739~1666289067~22.04~fe0ce53 SMP PREEMPT_DYNAMIC Thu O machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8

pandas : 2.0.3 numpy : 1.24.3 pytz : 2022.7 dateutil : 2.8.2 setuptools : 68.0.0 pip : 23.2.1 pytest : 8.1.1 sphinx : 7.2.6 lxml.etree : 4.9.2 jinja2 : 3.1.2 IPython : 8.12.2 bs4 : 4.12.2 bottleneck : 1.3.5 fsspec : 2023.4.0 matplotlib : 3.7.1 numba : 0.57.1 numexpr : 2.8.4 openpyxl : 3.1.2 pyarrow : 11.0.0 scipy : 1.11.1 xarray : 2023.6.0 tzdata : 2023.3

Description of expected behavior and the observed behavior

Expect the panel dashboard to display plots without raising an error when selecting columns of a dataframe or groups of columns with hv.Curve. Observed behavior is an error is raised. The plotting still function correctly despite the error.

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

I have not been able to reliably reproduce the error.

Stack traceback and/or browser JavaScript console output

Traceback (most recent call last): File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/viewable.py", line 591, in _preprocess hook(self, root, changed, old_models) TypeError: link_axes() takes 2 positional arguments but 4 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/pyviz_comms/init.py", line 340, in _handle_msg self._on_msg(msg) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/viewable.py", line 471, in _on_msg doc.unhold() File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/bokeh/document/document.py", line 776, in unhold self.callbacks.unhold() File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/bokeh/document/callbacks.py", line 431, in unhold self.trigger_on_change(event) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/bokeh/document/callbacks.py", line 408, in trigger_on_change invoke_with_curdoc(doc, event.callback_invoker) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc return f() ^^^ File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/bokeh/util/callback_manager.py", line 185, in invoke callback(attr, old, new) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/reactive.py", line 469, in _comm_change state._handle_exception(e) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/io/state.py", line 436, in _handle_exception raise exception File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/reactive.py", line 467, in _comm_change self._schedule_change(doc, comm) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/reactive.py", line 449, in _schedule_change self._change_event(doc) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/reactive.py", line 445, in _change_event self._process_events(events) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/reactive.py", line 384, in _process_events self.param.update(selfevents) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 1902, in update self._batch_call_watchers() File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 2063, in _batch_callwatchers self._execute_watcher(watcher, events) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 2025, in _execute_watcher watcher.fn(*args, *kwargs) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/param.py", line 869, in _replace_pane self._update_inner(new_object) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/pane/base.py", line 704, in _update_inner new_pane, internal = self._update_from_object( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/pane/base.py", line 682, in _update_from_object old_object.object = object ^^^^^^^^^^^^^^^^^ File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 369, in _f return f(self, obj, val) ^^^^^^^^^^^^^^^^^ File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 1252, in set obj.param._call_watcher(watcher, event) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 2043, in _callwatcher self._execute_watcher(watcher, (event,)) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/param/parameterized.py", line 2025, in _execute_watcher watcher.fn(args, kwargs) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/pane/base.py", line 324, in _update_pane self._update_object(ref, doc, root, parent, comm) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/pane/base.py", line 315, in _update_object state._views[ref][0]._preprocess(root) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/viewable.py", line 593, in _preprocess hook(self, root) File "/home/ben/miniconda3/envs/pvcaptest/lib/python3.11/site-packages/panel/pane/holoviews.py", line 862, in link_axes if axis.start > axis.end: ^^^^^^^^^^^^^^^^^^^^^ TypeError: The DType <class 'numpy.dtype[datetime64]'> could not be promoted by <class 'numpy.dtype[float64]'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is object. The full list of DTypes is: (<class 'numpy.dtype[datetime64]'>, <class 'numpy.dtype[float64]'>)

Screenshots or screencasts of the bug in action

[ x ] I may be interested in making a pull request to address this, but I would need assistance figuring out how to reproduce the error reliably.

philippjfr commented 7 months ago

Oops, this does appear a Panel issue.

cchan-lm commented 6 months ago

Hi @philippjfr, hope you're well! Is there progress on a bugfix or is the root cause known?