AutoViML/AutoViz

"AttributeError: module 'inspect' has no attribute 'ArgSpec'", thrown up by outdated holoviews version when used in Python 3.11 environment

RNarayan73 opened this issue ยท 32 comments

Versions:

Python = 3.11
pandas = 1.5.3 (autoviz also needs updating to latest version of pandas - 2.1)
numpy = 1.23.5 (autoviz also needs updating to latest version of numpy - 1.26)
bokeh = 2.4.3 (udpating it to 3.* downgrades autoviz to 0.1.24)
dash = 2.14.0

Error produced:

AttributeError                            Traceback (most recent call last)
Cell In[19], line 7
      4 np.bool = bool
      6 AV = AutoViz_Class()
----> 7 av = AV.AutoViz(filename='', sep=',', header=0, 
      8                 depVar='result', dfte=DATA1, 
      9                 lowess=False,
     10                 max_rows_analyzed=150000, max_cols_analyzed=100, 
     11                 verbose=1, chart_format='bokeh', #'html', #
     12                 #verbose=2, chart_format='html', # creates separate and very large files
     13                 save_plot_dir=None
     14                )

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Class.py:257, in AutoViz_Class.AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    255 ####################################################################################
    256 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']:
--> 257     dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose,
    258                 lowess,chart_format,max_rows_analyzed,
    259                     max_cols_analyzed, save_plot_dir)
    260 else:
    261     dft = self.AutoViz_Main(filename, sep, depVar, dfte, header, verbose,
    262                 lowess,chart_format,max_rows_analyzed,
    263                     max_cols_analyzed, save_plot_dir)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:181, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    178         drawobj2 = draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep,
    179                        classes, lowess, mk_dir, verbose)
    180         ls_objects.append(drawobj2)
--> 181 drawobj3 = draw_distplot_hv(dfin, cats, nums, chart_format, problem_type, dep, classes, mk_dir, verbose)
    182 ls_objects.append(drawobj3)
    183 ### kdeplot is the only time you send in ls_objects since it has to be returned with 2 objects ###

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:722, in draw_distplot_hv(dft, cats, conti, chart_format, problem_type, dep, classes, mk_dir, verbose)
    720     return plot
    721 #######  This is where you call the widget and pass it the select_variable to draw a Chart #######
--> 722 dmap = hv.DynamicMap(select_widget,  kdims=['Select_categorical_var']).redim.values(
    723                                     Select_categorical_var=cats)
    724 ###########  This is where you put the Panel Together ############
    725 hv_panel = pn.panel(dmap)

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\spaces.py:923, in DynamicMap.__init__(self, callback, initial_items, streams, **params)
    919     raise TypeError(msg.format(objs = ', '.join('%r' % el for el in invalid)))
    921 super(DynamicMap, self).__init__(initial_items, callback=callback, streams=valid, **params)
--> 923 if self.callback.noargs:
    924     prefix = 'DynamicMaps using generators (or callables without arguments)'
    925     if self.kdims:

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\spaces.py:640, in Callable.noargs(self)
    637 @property
    638 def noargs(self):
    639     "Returns True if the callable takes no arguments"
--> 640     noargs = inspect.ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
    641     return self.argspec == noargs

AttributeError: module 'inspect' has no attribute 'ArgSpec'

To reproduce error:

Just run autoviz with following parameters:

from sklearn.datasets import fetch_california_housing

data = fetch_california_housing()
test = pd.concat([pd.DataFrame(data['data'], columns=data['feature_names']), pd.DataFrame(data['target'], columns=data['target_names'])], axis=1)

from autoviz import AutoViz_Class

AV = AutoViz_Class()
av = AV.AutoViz(filename='', sep=',', header=0, 
                depVar='MedHouseVal', 
                dfte=test, 
                lowess=False,
                max_rows_analyzed=150000, max_cols_analyzed=100, 
                verbose=1, chart_format='bokeh', 
                save_plot_dir=None
               )

Hi @RNarayan73 ๐Ÿ‘
Thanks for testing AutoViz. I tried to reproduce your error in my machine's notebook and I got no errors. it works fine! Take a look at the screenshot.
image

Please upgrade your package and close it if it works.
Auto Vimal

I created a new environment with Python 3.11 and yet, I still get the same error as above!

Note that I have installed the following dependencies with version constraints:

  • python = 3.11.6
  • pandas = 1.5.3
  • numpy = 1.23.5
  • bokeh = 2.4.3
  • dash = 2.14.1
  • dash-core-components = 2.0.0
  • dash-html-components = 2.0.0
  • werkzeug = 2.2.3
  • kaleido = 0.2.1

All other dependencies are on latest versions.

Are these consistent with your environment?

Hi @RNarayan73 ๐Ÿ‘
There seems to be lots of problems with python new versions
According to this page,
"The error you are seeing is related to python 3.11. Try to downgrade to python 3.10 or even lower."

https://discourse.holoviz.org/t/streamz-hvplot-seems-fairly-broken-any-alternatives/4593/6

I have Python 3.8 on my computer so I can't see any errors.
Auto Vimal

@AutoViML I have been running it on Python 3.10 successfully and yes, as I mentioned in the first post, it is a problem specific to Python 3.11.

I have been doing some housekeeping since Python 3.12 was released and upgraded all my other environments to Python 3.11 / 3.12 but, the environment with AutoViML is the only one left out due to this issue. Hence was keen to have this resolved.

I followed through on the link above and posted a query to which I got a reply that hvplot does support Python 3.11 & 3.12.

So, is this something to do with your code and the fact that it installs hvplot 0.7.3 and holoviews 1.14.9 rather than the latest?

Narayan

Hi @RNarayan73 ๐Ÿ‘
It is possible that the error may be due to AutoVimL installing hvplot 0.7.3 and holoviews 1.14.9 rather than the latest. But I am not ready to move to their latest versions since many people won't have the latest. I would rather that you downgrade your versions to the older ones or try this in a Colab env if it doesn't suit your machine.

@AutoViML

That's indeed a shame. You do realize that it's not only the python version that AutoViz is lagging on. In summary, AutoViz reqiures

  • python version 3.10.* when current version is 3.12.*
  • numpy version 1.23.* when current version is 1.26.*
  • pandas version 1.5.* when current version is 2.1.*
  • bokeh version 2.* when current version is 3.3.*
  • hvplot version 0.7.3 when current version is 0.9.*
  • holoviews version 1.14.9 when current version is 1.18.*

That's a fair bit of catching up to do to just keep up-to-date with the dependencies!

Hi @RNarayan73
thanks for the heads-up ๐Ÿ‘
I suggest that you create a new conda env for AutoViz if you need those latest versions to not conflict with AutoViz.

In the meantime, let me see whether I can upgrade AutoViz to Python 3.10 version (at least). I'll also have to check if importing hvplot and pyviz can be made within function calls so I can remove their versions from requirements.txt and setup.py files. It seems like hvplot and pyviz are changing too much for me to hold AutoViz to a consistent version.
Give me a few days.
Thanks
Auto Vimal

@AutoViML
I am already running AutoViML successfully in a separate virtual environment with python 3.10 and the restricted versions on the list mentioned in my previous post.
It needs to be updated to versions closer to the recent ones on the right in my previous post.
Thanks for your efforts.
Narayan

@RNarayan73 ๐Ÿ‘
I have some good news. I have recently removed some references to seaborn styles that were causing some issues in matplotlib. This might fix your issues as well. Please check by upgrading AutoViz to the latest version (0.1.735) and let me know

Auto Vimal

@AutoViML I tried, but looks like the matplotlib version 3.5.3 required doesn't have wheels available on pypi.

Building wheels for collected packages: matplotlib
  Building wheel for matplotlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  ร— Building wheel for matplotlib (pyproject.toml) did not run successfully.
  โ”‚ exit code: 1
  โ•ฐโ”€> [564 lines of output]
      C:\Users\naray\AppData\Local\Temp\pip-build-env-ger7g65_\overlay\Lib\site-packages\setuptools\dist.py:674: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated.
      !!

              ********************************************************************************
              Please replace its usage with implicit namespaces (PEP 420).

              See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages for details.
              ********************************************************************************

      !!
        ep.load()(self, ep.name, value)

      Edit mplsetup.cfg to change the build options; suppress output with --quiet.

      BUILDING MATPLOTLIB
            python: yes [3.11.7 (tags/v3.11.7:fa7a6f2, Dec  4 2023, 19:24:49) [MSC
                        v.1937 64 bit (AMD64)]]
          platform: yes [win32]
             tests: no  [skipping due to configuration]
            macosx: no  [Mac OS-X only]

      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      copying lib\pylab.py -> build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\matplotlib
      copying lib\matplotlib\afm.py -> build\lib.win-amd64-cpython-311\matplotlib
      copying lib\matplotlib\animation.py -> build\lib.win-amd64-cpython-311\matplotlib
      copying lib\matplotlib\artist.py -> build\lib.win-amd64-cpython-311\matplotlib
      copying lib\matplotlib\axis.py -> build\lib.win-amd64-cpython-311\matplotlib
      copying lib\matplotlib\backend_bases.py -> build\lib.win-amd64-cpython-311\matplotlib
      copying lib\matplotlib\backend_managers.py -> build\lib.win-amd64-cpython-311\matplotlib

<<< truncated for brevity >>>

      copying lib\matplotlib\mpl-data\sample_data\Minduka_Present_Blue_Pack.png -> build\lib.win-amd64-cpython-311\matplotlib\mpl-data\sample_data
      running build_ext
      Extracting /project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
      Building freetype in build\freetype-2.6.1
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for matplotlib
Failed to build matplotlib
ERROR: Could not build wheels for matplotlib, which is required to install pyproject.toml-based projects

Note the current version of matplotlib is 3.8.2, so forcing 3.5.3 is a retrograde step. I have version 3.7.4 of matplotlib happily working with autoviz 0.1.732 in a python 3.10 environment which avoids the seaborn issue and runs successfully. I have installed matplotlib 3.7.4 in a python 3.11 environment with autoviz 0.1.732 too and believe it avoids this issue here too as I don't get the 'seaborn' error, but the one above!

Hi @RNarayan73 ๐Ÿ‘
I have finally found the dependency problems with Python 3.10+ and fixed them I think.
I have a new version 0.1.801 of AutoViz - please pip install and try it ๐Ÿ‘
Thanks for your patience,
Auto Vimal

@AutoViML great! It seems to haves removed the previous error in a Python 3.11 environment, but probably requires a bit of tidying up for the various charts.

Latest error for scatterplot:

TypeError                                 Traceback (most recent call last)
Cell In[17], line 7
      4 np.bool = bool
      6 AV = AutoViz_Class()
----> 7 av = AV.AutoViz(filename='', sep=',', header=0, 
      8                 depVar='result', #'MedHouseVal', #
      9                 dfte=DATA1, #test, #
     10                 lowess=False,
     11                 max_rows_analyzed=150000, max_cols_analyzed=100, 
     12                 verbose=1, chart_format='bokeh', #'html', #
     13                 #verbose=2, chart_format='html', # creates separate and very large files
     14                 save_plot_dir=None
     15                )

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Class.py:256, in AutoViz_Class.AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    254 ####################################################################################
    255 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']:
--> 256     dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose,
    257                 lowess,chart_format,max_rows_analyzed,
    258                     max_cols_analyzed, save_plot_dir)
    259 else:
    260     dft = self.AutoViz_Main(filename, sep, depVar, dfte, header, verbose,
    261                 lowess,chart_format,max_rows_analyzed,
    262                     max_cols_analyzed, save_plot_dir)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:207, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    205     ### You can draw pair scatters only if there are 2 or more numeric variables ####
    206     if len(nums) >= 2:
--> 207         drawobj2 = draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep,
    208                        classes, lowess, mk_dir, verbose)
    209         ls_objects.append(drawobj2)
    210 drawobj3 = draw_distplot_hv(dfin, cats, nums, chart_format, problem_type, dep, classes, mk_dir, verbose)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:585, in draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep, classes, lowess, mk_dir, verbose)
    580     return hv.Points(dft, [x, y], label="%s vs %s" % (x.title(), y.title()),
    581         title='Pair-wise Scatter Plot of two Independent Numeric variables').opts(**opts)
    583 widgets = pn.WidgetBox(x, y, color)
--> 585 hv_panel = pn.Row(widgets, create_figure).servable('Cross-selector')
    586 #########  This is an old way to plot a pair-wise scatter plot ####
    587 #target_vars = dft[dep].unique()
    588 #x = pn.widgets.Select(name='x', options=nums)
   (...)
    593 #                title='Pair-wise Scatter Plot of two Independent Numeric variables')
    594 #hv_panel = pn.Row(pn.WidgetBox(x, y, kind), plot)
    595 if verbose == 2:

File ~\Python\venvs\eda311\Lib\site-packages\panel\layout\base.py:805, in ListPanel.__init__(self, *objects, **params)
    801     if 'objects' in params:
    802         raise ValueError("A %s's objects should be supplied either "
    803                          "as positional arguments or as a keyword, "
    804                          "not both." % type(self).__name__)
--> 805     params['objects'] = [panel(pane) for pane in objects]
    806 elif 'objects' in params:
    807     objects = params['objects']

File ~\Python\venvs\eda311\Lib\site-packages\panel\layout\base.py:805, in <listcomp>(.0)
    801     if 'objects' in params:
    802         raise ValueError("A %s's objects should be supplied either "
    803                          "as positional arguments or as a keyword, "
    804                          "not both." % type(self).__name__)
--> 805     params['objects'] = [panel(pane) for pane in objects]
    806 elif 'objects' in params:
    807     objects = params['objects']

File ~\Python\venvs\eda311\Lib\site-packages\panel\pane\base.py:87, in panel(obj, **kwargs)
     85 if kwargs.get('name', False) is None:
     86     kwargs.pop('name')
---> 87 pane = PaneBase.get_pane_type(obj, **kwargs)(obj, **kwargs)
     88 if len(pane.layout) == 1 and pane._unpack:
     89     return pane.layout[0]

File ~\Python\venvs\eda311\Lib\site-packages\panel\param.py:799, in ParamMethod.__init__(self, object, **params)
    797 self._validate_object()
    798 if not self.defer_load:
--> 799     self._replace_pane()

File ~\Python\venvs\eda311\Lib\site-packages\panel\param.py:865, in ParamMethod._replace_pane(self, force, *args)
    863     new_object = Spacer()
    864 else:
--> 865     new_object = self.eval(self.object)
    866 if inspect.isawaitable(new_object) or isinstance(new_object, types.AsyncGeneratorType):
    867     param.parameterized.async_executor(partial(self._eval_async, new_object))

File ~\Python\venvs\eda311\Lib\site-packages\panel\param.py:824, in ParamMethod.eval(self, function)
    822 @classmethod
    823 def eval(self, function):
--> 824     return eval_function_with_deps(function)

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:162, in eval_function_with_deps(function)
    160         args = (getattr(dep.owner, dep.name) for dep in arg_deps)
    161         kwargs = {n: getattr(dep.owner, dep.name) for n, dep in kw_deps.items()}
--> 162 return function(*args, **kwargs)

File ~\Python\venvs\eda311\Lib\site-packages\param\depends.py:41, in depends.<locals>._depends(*args, **kw)
     39 @wraps(func)
     40 def _depends(*args, **kw):
---> 41     return func(*args, **kw)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:580, in draw_pair_scatters_hv.<locals>.create_figure(x, y, color)
    578 opts['toolbar'] = 'above'
    579 opts['colorbar'] = True
--> 580 return hv.Points(dft, [x, y], label="%s vs %s" % (x.title(), y.title()),
    581     title='Pair-wise Scatter Plot of two Independent Numeric variables').opts(**opts)

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\element\selection.py:24, in SelectionIndexExpr.__init__(self, *args, **kwargs)
     23 def __init__(self, *args, **kwargs):
---> 24     super().__init__(*args, **kwargs)
     25     self._index_skip = False

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\data\__init__.py:332, in Dataset.__init__(self, data, kdims, vdims, **kwargs)
    329 initialized = Interface.initialize(type(self), data, kdims, vdims,
    330                                    datatype=kwargs.get('datatype'))
    331 (data, self.interface, dims, extra_kws) = initialized
--> 332 super().__init__(data, **dict(kwargs, **dict(dims, **extra_kws)))
    333 self.interface.validate(self, validate_vdims)
    335 # Handle _pipeline property

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\dimension.py:841, in Dimensioned.__init__(self, data, kdims, vdims, **params)
    838 if 'cdims' in params:
    839     params['cdims'] = {d if isinstance(d, Dimension) else Dimension(d): val
    840                        for d, val in params['cdims'].items()}
--> 841 super().__init__(data, **params)
    842 self.ndims = len(self.kdims)
    843 cdims = [(d.name, val) for d, val in self.cdims.items()]

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\dimension.py:500, in LabelledData.__init__(self, data, id, plot_id, **params)
    497     util.group_sanitizer.add_aliases(**{alias:long_name})
    498     params['group'] = long_name
--> 500 super().__init__(**params)
    501 if not util.group_sanitizer.allowable(self.group):
    502     raise ValueError("Supplied group %r contains invalid characters." %
    503                      self.group)

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:4148, in Parameterized.__init__(self, **params)
   4146 if self.param.name.default == self.__class__.__name__:
   4147     self.param._generate_name()
-> 4148 refs, deps = self.param._setup_params(**params)
   4149 object_count += 1
   4151 self._param__private.initialized = True

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:1678, in as_uninitialized.<locals>.override_initialization(self_, *args, **kw)
   1676 original_initialized = parameterized_instance._param__private.initialized
   1677 parameterized_instance._param__private.initialized = False
-> 1678 ret = fn(self_, *args, **kw)
   1679 parameterized_instance._param__private.initialized = original_initialized
   1680 return ret

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:1934, in Parameters._setup_params(self_, **params)
   1932 desc = self_.cls.get_param_descriptor(name)[0] # pylint: disable-msg=E1101
   1933 if not desc:
-> 1934     raise TypeError(
   1935         f"{self.__class__.__name__}.__init__() got an unexpected "
   1936         f"keyword argument {name!r}"
   1937     )
   1939 pobj = objects.get(name)
   1940 if pobj is None or not pobj.allow_refs:
   1941     # Until Parameter.allow_refs=True by default we have to
   1942     # speculatively evaluate a values to check whether they
   1943     # contain a reference and warn the user that the
   1944     # behavior may change in future.

TypeError: Points.__init__() got an unexpected keyword argument 'title'

Furthermore, installing only bokeh as a dependency doesn't automatically install holoviews and hvplot. The latter have to be explicitly installed.

Hi @RNarayan73
Thanks for pointing out the bug ๐Ÿ‘

I have now fixed it and you should upgrade to the latest version and check:

pip install autoviz==0.1.802

Let me know
auto vimal

@AutoViML thanks.
Next bug:

Imported v0.1.802. After importing autoviz, you must run '%matplotlib inline' to display charts inline.
    AV = AutoViz_Class()
    dfte = AV.AutoViz(filename, sep=',', depVar='', dfte=None, header=0, verbose=1, lowess=False,
               chart_format='svg',max_rows_analyzed=150000,max_cols_analyzed=30, save_plot_dir=None)
Shape of your Data Set loaded: (30747, 21)
#######################################################################################
######################## C L A S S I F Y I N G  V A R I A B L E S  ####################
#######################################################################################
Classifying variables in data set...
    Number of Numeric Columns =  3
    Number of Integer-Categorical Columns =  9
    Number of String-Categorical Columns =  0
    Number of Factor-Categorical Columns =  7
    Number of String-Boolean Columns =  0
    Number of Numeric-Boolean Columns =  1
    Number of Discrete String Columns =  0
    Number of NLP String Columns =  0
    Number of Date Time Columns =  0
    Number of ID Columns =  0
    Number of Columns to Delete =  0
    20 Predictors classified...
        No variables removed since no ID or low-information variables found in data set

################ Binary_Classification problem #####################
WARNING:param.Scatter: Chart elements should only be supplied a single kdim
 ValueError: Callable parameter 'Callable.callable' only takes a callable object, not objects of <class 'holoviews.core.layout.Layout'>. 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[15], line 7
      4 np.bool = bool
      6 AV = AutoViz_Class()
----> 7 av = AV.AutoViz(filename='', sep=',', header=0, 
      8                 depVar='result', #'MedHouseVal', #
      9                 dfte=DATA1, #test, #
     10                 lowess=False,
     11                 max_rows_analyzed=150000, max_cols_analyzed=100, 
     12                 verbose=1, chart_format='bokeh', #'html', #
     13                 #verbose=2, chart_format='html', # creates separate and very large files
     14                 save_plot_dir=None
     15                )

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Class.py:256, in AutoViz_Class.AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    254 ####################################################################################
    255 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']:
--> 256     dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose,
    257                 lowess,chart_format,max_rows_analyzed,
    258                     max_cols_analyzed, save_plot_dir)
    259 else:
    260     dft = self.AutoViz_Main(filename, sep, depVar, dfte, header, verbose,
    261                 lowess,chart_format,max_rows_analyzed,
    262                     max_cols_analyzed, save_plot_dir)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:213, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    211 ls_objects.append(drawobj3)
    212 ### kdeplot is the only time you send in ls_objects since it has to be returned with 2 objects ###
--> 213 drawobj4 = draw_kdeplot_hv(dfin, cats, nums, chart_format, problem_type, dep, ls_objects, mk_dir, verbose)
    214 if not drawobj4:
    215     ### if it is not blank, then treat it as ls_objects ###
    216     ls_objects = copy.deepcopy(drawobj4)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:332, in draw_kdeplot_hv(dfin, cats, nums, chart_format, problem_type, dep, ls_objects, mk_dir, verbose)
    330 if problem_type.endswith('Classification'):
    331     colors = cycle('brycgkbyrcmgkbyrcmgkbyrcmgkbyr')
--> 332     dmap = hv.DynamicMap(return_dynamic_objects(dfin, dep, title='Percent Distribution of Target variable'
    333                     ).opts(shared_axes=False).opts(title='Histogram and KDE of Target = %s' %dep)).opts(
    334                         height=height_size, width=width_size)
    335     dmap.opts(framewise=True,axiswise=True) ## both must be True for your charts to have dynamically varying axes!
    336     hv_all = pn.pane.HoloViews(dmap)#, sizing_mode="stretch_both")

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\spaces.py:786, in DynamicMap.__init__(self, callback, initial_items, streams, **params)
    784     callback = Generator(callback)
    785 elif not isinstance(callback, Callable):
--> 786     callback = Callable(callback)
    788 valid, invalid = Stream._process_streams(streams)
    789 if invalid:

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\spaces.py:497, in Callable.__init__(self, callable, **params)
    496 def __init__(self, callable, **params):
--> 497     super().__init__(callable=callable,
    498                      **dict(params, name=util.callable_name(callable)))
    499     self._memoized = {}
    500     self._is_overlay = False

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:4148, in Parameterized.__init__(self, **params)
   4146 if self.param.name.default == self.__class__.__name__:
   4147     self.param._generate_name()
-> 4148 refs, deps = self.param._setup_params(**params)
   4149 object_count += 1
   4151 self._param__private.initialized = True

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:1678, in as_uninitialized.<locals>.override_initialization(self_, *args, **kw)
   1676 original_initialized = parameterized_instance._param__private.initialized
   1677 parameterized_instance._param__private.initialized = False
-> 1678 ret = fn(self_, *args, **kw)
   1679 parameterized_instance._param__private.initialized = original_initialized
   1680 return ret

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:1962, in Parameters._setup_params(self_, **params)
   1950         if ref:
   1951             warnings.warn(
   1952                 f"Parameter {name!r} on {pobj.owner} is being given a valid parameter "
   1953                 f"reference {val} but is implicitly allow_refs=False. "
   (...)
   1960                 stacklevel=4,
   1961             )
-> 1962     setattr(self, name, val)
   1963     continue
   1965 # Resolve references

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:527, in instance_descriptor.<locals>._f(self, obj, val)
    525         instance_param.__set__(obj, val)
    526         return
--> 527 return f(self, obj, val)

File ~\Python\venvs\eda311\Lib\site-packages\param\parameterized.py:1490, in Parameter.__set__(self, obj, val)
   1482     if self.set_hook is not _identity_hook:
   1483         # PARAM3_DEPRECATION
   1484         warnings.warn(
   1485             'Number.set_hook has been deprecated.',
   1486             category=_ParamDeprecationWarning,
   1487             stacklevel=6,
   1488         )
-> 1490 self._validate(val)
   1492 _old = NotImplemented
   1493 # obj can be None if __set__ is called for a Parameterized class

File ~\Python\venvs\eda311\Lib\site-packages\param\parameters.py:1509, in Callable._validate(self, val)
   1508 def _validate(self, val):
-> 1509     self._validate_value(val, self.allow_None)

File ~\Python\venvs\eda311\Lib\site-packages\param\parameters.py:1503, in Callable._validate_value(self, val, allow_None)
   1501 if (allow_None and val is None) or callable(val):
   1502     return
-> 1503 raise ValueError(
   1504     f"{_validate_error_prefix(self)} only takes a callable object, "
   1505     f"not objects of {type(val)}."
   1506 )

ValueError: Callable parameter 'Callable.callable' only takes a callable object, not objects of <class 'holoviews.core.layout.Layout'>.

A few other niggles:

  1. Specifying bokeh during install doesn't automatically install hvplot as a dependency. The latter has to be explicitly specified.
  2. Warning as below when installing the outdated version of xgboost; Perhaps udpate to the current version 2.0.3?

Warning: Validation of the RECORD file of xgboost-1.6.2-py3-none-win_amd64.whl failed. Please report to the maintainers of that package so they can fix their build process. Details:
In C:\Users\naray\Python\pypoetry\Cache\artifacts\33\e2\39\0040350b9bed5a923d94b1755a79c8cbfeb0385323c9bad8d8cb4389f8\xgboost-1.6.2-py3-none-win_amd64.whl, xgboost-1.6.2+b9934246faa9a25e10a12339685dfbe56d56f70b.data/data/xgboost/vcomp140.dll is not mentioned in RECORD

  1. May I suggest changing version to a more pythonic-friendly scheme like 1.8.2 or 0.8.2, if that's okay.

Hi @RNarayan73 ๐Ÿ‘
I have modified the kdeplot to skip it if it errors since I think the problem is with HoloViews' DynamicMaps which is very buggy. I don't want people to be bogged down with it.

The rest of your suggestions as below:
Specifying bokeh during install doesn't automatically install hvplot as a dependency. The latter has to be explicitly specified.
Yes I have specified that both Bokeh and hvplot have to be installed.
Warning as below when installing the outdated version of xgboost; Perhaps udpate to the current version 2.0.3?
No i cannot upgrade to XGB 1.8.2 since they changed the APi and I cannot change mine.

Good luck, Try to upgrade once more to the latest version and try AutoViz. It should work now.

Thanks
Auto Vimal

@AutoViML
I tried the new version and the latest error persists in a python 3.11 environment. It might be you worth testing with the example I had provided earlier before release. I reproduce it below:

from sklearn.datasets import fetch_california_housing

data = fetch_california_housing()
test = pd.concat([pd.DataFrame(data['data'], columns=data['feature_names']), pd.DataFrame(data['target'], columns=data['target_names'])], axis=1)

from autoviz import AutoViz_Class

AV = AutoViz_Class()
av = AV.AutoViz(filename='', sep=',', header=0, 
                depVar='MedHouseVal', 
                dfte=test, 
                lowess=False,
                max_rows_analyzed=150000, max_cols_analyzed=100, 
                verbose=1, chart_format='bokeh', 
                save_plot_dir=None
               )

Can you post the latest error you are getting with AutoViz in a python 3.11 version? Also I am not sure if you have done a pip install of the latest version?

@AutoViML, I noticed this error is the same as issues #101 & #102

Here's the output of import autoviz:

Imported v0.1.803. After importing autoviz, you must run '%matplotlib inline' to display charts inline.
AV = AutoViz_Class()
dfte = AV.AutoViz(filename, sep=',', depVar='', dfte=None, header=0, verbose=1, lowess=False,
chart_format='svg',max_rows_analyzed=150000,max_cols_analyzed=30, save_plot_dir=None)

For the code snippet from my previous post, here's the output:

Shape of your Data Set loaded: (20640, 9)
#######################################################################################
######################## C L A S S I F Y I N G  V A R I A B L E S  ####################
#######################################################################################
Classifying variables in data set...
    Number of Numeric Columns =  8
    Number of Integer-Categorical Columns =  0
    Number of String-Categorical Columns =  0
    Number of Factor-Categorical Columns =  0
    Number of String-Boolean Columns =  0
    Number of Numeric-Boolean Columns =  0
    Number of Discrete String Columns =  0
    Number of NLP String Columns =  0
    Number of Date Time Columns =  0
    Number of ID Columns =  0
    Number of Columns to Delete =  0
    8 Predictors classified...
        No variables removed since no ID or low-information variables found in data set

################ Regression problem #####################
 ValueError: ClassSelector parameter None value must be an instance of (function, tuple), not <function size at 0x000001E943902730>. 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[16], line 11
      8 from autoviz import AutoViz_Class
     10 AV = AutoViz_Class()
---> 11 av = AV.AutoViz(filename='', sep=',', header=0, 
     12                 depVar='MedHouseVal', 
     13                 dfte=test, 
     14                 lowess=False,
     15                 max_rows_analyzed=150000, max_cols_analyzed=100, 
     16                 verbose=1, chart_format='bokeh', 
     17                 save_plot_dir=None
     18                )

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Class.py:256, in AutoViz_Class.AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    254 ####################################################################################
    255 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']:
--> 256     dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose,
    257                 lowess,chart_format,max_rows_analyzed,
    258                     max_cols_analyzed, save_plot_dir)
    259 else:
    260     dft = self.AutoViz_Main(filename, sep, depVar, dfte, header, verbose,
    261                 lowess,chart_format,max_rows_analyzed,
    262                     max_cols_analyzed, save_plot_dir)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:202, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    200     print('No scatter plots with depVar when no depVar is given.')
    201 else:
--> 202     drawobj1 = draw_scatters_hv(dfin,nums,chart_format,problem_type,
    203                   dep, classes, lowess, mk_dir, verbose)
    204     ls_objects.append(drawobj1)
    205 ### You can draw pair scatters only if there are 2 or more numeric variables ####

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:375, in draw_scatters_hv(dft, nums, chart_format, problem_type, dep, classes, lowess, mk_dir, verbose)
    373 def draw_scatters_hv(dft, nums, chart_format, problem_type,
    374                   dep=None, classes=None, lowess=False, mk_dir='AutoViz_Plots', verbose=0):
--> 375     ensure_hvplot_imported()
    376     ######## SCATTER PLOTS ARE USEFUL FOR COMPARING NUMERIC VARIABLES
    377     ##### we are going to modify dfin and classes, so we are making copies to make changes
    378     dft = copy.deepcopy(dft)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:59, in ensure_hvplot_imported()
     56 global hv, opts, pn, pnw, INLINE, classify_columns
     57 try:
     58     # Import main modules
---> 59     import hvplot.pandas
     60     import holoviews as hv
     61     import panel as pn

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 0x000001E943902730>.

Hope this helps.

While attempting to fix issue #102, this error has now re-emerged in version 0.1.804. Error log below:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[19], line 7
      4 np.bool = bool
      6 AV = AutoViz_Class()
----> 7 av = AV.AutoViz(filename='', sep=',', header=0, 
      8                 depVar='result', #'MedHouseVal', #
      9                 dfte=DATA1, #test, #
     10                 lowess=False,
     11                 max_rows_analyzed=150000, max_cols_analyzed=100, 
     12                 verbose=1, chart_format='bokeh', #'html', #
     13                 #verbose=2, chart_format='html', # creates separate and very large files
     14                 save_plot_dir=None
     15                )

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Class.py:256, in AutoViz_Class.AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    254 ####################################################################################
    255 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']:
--> 256     dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose,
    257                 lowess,chart_format,max_rows_analyzed,
    258                     max_cols_analyzed, save_plot_dir)
    259 else:
    260     dft = self.AutoViz_Main(filename, sep, depVar, dfte, header, verbose,
    261                 lowess,chart_format,max_rows_analyzed,
    262                     max_cols_analyzed, save_plot_dir)

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:210, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    207         drawobj2 = draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep,
    208                        classes, lowess, mk_dir, verbose)
    209         ls_objects.append(drawobj2)
--> 210 drawobj3 = draw_distplot_hv(dfin, cats, nums, chart_format, problem_type, dep, classes, mk_dir, verbose)
    211 ls_objects.append(drawobj3)
    212 ### kdeplot is the only time you send in ls_objects since it has to be returned with 2 objects ###

File ~\Python\venvs\eda311\Lib\site-packages\autoviz\AutoViz_Holo.py:784, in draw_distplot_hv(dft, cats, conti, chart_format, problem_type, dep, classes, mk_dir, verbose)
    782     return plot
    783 #######  This is where you call the widget and pass it the select_variable to draw a Chart #######
--> 784 dmap = hv.DynamicMap(select_widget,  kdims=['Select_categorical_var']).redim.values(
    785                                     Select_categorical_var=cats)
    786 ###########  This is where you put the Panel Together ############
    787 hv_panel = pn.panel(dmap)

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\spaces.py:923, in DynamicMap.__init__(self, callback, initial_items, streams, **params)
    919     raise TypeError(msg.format(objs = ', '.join('%r' % el for el in invalid)))
    921 super(DynamicMap, self).__init__(initial_items, callback=callback, streams=valid, **params)
--> 923 if self.callback.noargs:
    924     prefix = 'DynamicMaps using generators (or callables without arguments)'
    925     if self.kdims:

File ~\Python\venvs\eda311\Lib\site-packages\holoviews\core\spaces.py:640, in Callable.noargs(self)
    637 @property
    638 def noargs(self):
    639     "Returns True if the callable takes no arguments"
--> 640     noargs = inspect.ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
    641     return self.argspec == noargs

AttributeError: module 'inspect' has no attribute 'ArgSpec'

@RNarayan73 : I have re-opened issue #98 - please post a solution here that I can implement.

@AutoViML thanks for re-opening.

After doing a bit of google search using the terms "python 3.11 inspect", I came across the following posts all of which suggest that inspect.getargspec() was deprecated since 3.0 but finally dropped in 3.11. They have replaced it with the replacement inspect.getfullargspec().
grpc/grpc#29962
pyinvoke/invoke#833
https://stackoverflow.com/questions/76151813/error-module-inspect-has-no-attribute-getargspec
https://stackoverflow.com/questions/74585622/pyfirmata-gives-error-module-inspect-has-no-attribute-getargspec

It appears to be a trivial problem that you could hopefully resolve by replacing inspect.ArgSpec() with inspect.FullArgSpec(). I have checked that this does exist in 3.11. Alternatively, change your code to use inspect.getfullargspec() method instead of ArgSpec (which on reading the 3.0 Python doc seems to be a named tuple output by the method) as all the maintainers in the above posts are doing.
https://docs.python.org/3.0/library/inspect.html?highlight=inspect#classes-and-functions

I'm not a library maintainer and have never used pull requests to modify other's code. I merely used existing packages for my own purpose, so I'm afraid I'll have a steeper learning curve than you to fix this.

I hope this helps you and look forward to a fix soon!

I also suggest that if you do manage to fix this, you try to incrementally remove other regressive changes such as forcing older versions of packages if possible. That would prevent similar roadblocks down the line

Narayan

Thank you @RNarayan73 ๐Ÿ‘
I don't see any inspect.ArgSpec() in any of AutoViz modules. This must be a code snippet from one of the hvplot or holoviews libraries. I don't think I can fix anything in my code.

@AutoViML

Indeed, it isn't an issue in the AutoViz code, but in the holoviews version installed as shown above!

See these comments by the holoviews maintainer on why it occurs and ways to resolve.
#102 (comment)
#102 (comment)

I hope this helps.

Naraayn

As indicated in #102 (comment), the fix for this in HoloViews has been released in version 1.15.3. So you'll need this version of HoloViews or an older one if you run your code with Python 3.11.

Since AutoViz pins HoloViews to 1.14.9 (this pin means holoviews >=1.14.9, <1.15.0):

"holoviews~=1.14.9",

@RNarayan73 you have a few solutions:

  • Update AutoViz to support newer versions of HoloViews. It might just require removing the pin, or it may require more work, I don't know (HoloViews is usually pretty stable).
  • Force installing holoviews >=1.15.3 in your environment after installing AutoViz, and cross your fingers
  • Use Python <= 3.11

@maximlt thanks for your suggestions.
I am currently on Python 3.10 which works fine, but am trying to upgrade all my environments to 3.11 and AutoViz is the only hold-up, hence I'm pursuing this with the maintainer
I'm sure, @AutoViML will be able to incorporate your suggestions to resolve it, as he works through upgrading the versions of other dependencies too.