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.08k stars 105 forks source link

ValueError: ClassSelector parameter None value must be an instance of (function, tuple), not <function size at ###> #1239

Closed RNarayan73 closed 8 months ago

RNarayan73 commented 9 months ago

Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at Discourse instead. Issues without the required information below may be closed immediately.

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc) hvplot == 0.7.3 holoviews = 1.14.9 bokeh == 2.4.3 python == 3.11

Description of expected behavior and the observed behavior

Cannot import hvplot

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

import hvplot

Stack traceback and/or browser JavaScript console output

ValueError                                Traceback (most recent call last)
Cell In[16], line 2
      1 from autoviz import AutoViz_Class
----> 2 import hvplot.pandas
      3 import numpy as np
      4 np.bool = bool

File ~\Python\venvs\eda311\Lib\site-packages\hvplot\__init__.py:12
      8 import holoviews as _hv
     10 from holoviews import Store
---> 12 from .converter import HoloViewsConverter
     13 from .util import get_ipy
     14 from .utilities import save, show # noqa

File ~\Python\venvs\eda311\Lib\site-packages\hvplot\converter.py:25
     18 from holoviews.core.util import max_range, basestring
     19 from holoviews.element import (
     20     Curve, Scatter, Area, Bars, BoxWhisker, Dataset, Distribution,
     21     Table, HeatMap, Image, HexTiles, QuadMesh, Bivariate, Histogram,
     22     Violin, Contours, Polygons, Points, Path, Labels, RGB, ErrorBars,
     23     VectorField, Rectangles, Segments
     24 )
---> 25 from holoviews.plotting.bokeh import OverlayPlot, colormap_generator
     26 from holoviews.plotting.util import process_cmap
     27 from holoviews.operation import histogram

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\plotting\bokeh\__init__.py:40
     38 from .graphs import GraphPlot, NodePlot, TriMeshPlot, ChordPlot
     39 from .heatmap import HeatMapPlot, RadialHeatMapPlot
---> 40 from .hex_tiles import HexTilesPlot
     41 from .path import PathPlot, PolygonPlot, ContourPlot
     42 from .plot import GridPlot, LayoutPlot, AdjointLayoutPlot

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\plotting\bokeh\hex_tiles.py:22
     18 from .selection import BokehOverlaySelectionDisplay
     19 from .styles import base_properties, line_properties, fill_properties
---> 22 class hex_binning(Operation):
     23     """
     24     Applies hex binning by computing aggregates on a hexagonal grid.
     25 
     26     Should not be user facing as the returned element is not directly
     27     useable.
     28     """
     30     aggregator = param.ClassSelector(
     31         default=np.size, class_=(types.FunctionType, tuple), doc="""
     32       Aggregation function or dimension transform used to compute bin
     33       values. Defaults to np.size to count the number of values
     34       in each bin.""")

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\plotting\bokeh\hex_tiles.py:30, in hex_binning()
     22 class hex_binning(Operation):
     23     """
     24     Applies hex binning by computing aggregates on a hexagonal grid.
     25 
     26     Should not be user facing as the returned element is not directly
     27     useable.
     28     """
---> 30     aggregator = param.ClassSelector(
     31         default=np.size, class_=(types.FunctionType, tuple), doc="""
     32       Aggregation function or dimension transform used to compute bin
     33       values. Defaults to np.size to count the number of values
     34       in each bin.""")
     36     gridsize = param.ClassSelector(default=50, class_=(int, tuple))
     38     invert_axes = param.Boolean(default=False)

File ~\Python\venvs\eda311\Lib\site-packages\param\__init__.py:1367, in ClassSelector.__init__(self, class_, default, instantiate, is_instance, **params)
   1365 self.is_instance = is_instance
   1366 super(ClassSelector,self).__init__(default=default,instantiate=instantiate,**params)
-> 1367 self._validate(default)

File ~\Python\venvs\eda311\Lib\site-packages\param\__init__.py:1371, in ClassSelector._validate(self, val)
   1369 def _validate(self, val):
   1370     super(ClassSelector, self)._validate(val)
-> 1371     self._validate_class_(val, self.class_, self.is_instance)

File ~\Python\venvs\eda311\Lib\site-packages\param\__init__.py:1383, in ClassSelector._validate_class_(self, val, class_, is_instance)
   1381 if is_instance:
   1382     if not (isinstance(val, class_)):
-> 1383         raise ValueError(
   1384             "%s parameter %r value must be an instance of %s, not %r." %
   1385             (param_cls, self.name, class_name, val))
   1386 else:
   1387     if not (issubclass(val, class_)):

ValueError: ClassSelector parameter None value must be an instance of (function, tuple), not <function size at 0x0000020F5A342CB0>.

Screenshots or screencasts of the bug in action

maximlt commented 8 months ago

Hi @RNarayan73, I replied in https://github.com/AutoViML/AutoViz/issues/102#issuecomment-1873874818 and am closing this issue as this issue has already been fixed in HoloViews and released. Feel free to comment if you think there's another way we could approach this in which case I'd be happy to re-open the issue.