AutoViML / AutoViz

Automatically Visualize any dataset, any size with a single line of code. Created by Ram Seshadri. Collaborators Welcome. Permission Granted upon Request.
Apache License 2.0
1.7k stars 196 forks source link

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

Closed RNarayan73 closed 3 months ago

RNarayan73 commented 10 months ago

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
               )
AutoViML commented 10 months ago

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

RNarayan73 commented 10 months ago

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:

All other dependencies are on latest versions.

Are these consistent with your environment?

AutoViML commented 10 months ago

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

RNarayan73 commented 9 months ago

@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

AutoViML commented 9 months ago

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.

RNarayan73 commented 9 months ago

@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

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

AutoViML commented 9 months ago

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

RNarayan73 commented 9 months ago

@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

AutoViML commented 8 months ago

@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

RNarayan73 commented 8 months ago

@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!

AutoViML commented 8 months ago

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

RNarayan73 commented 8 months ago

@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.

AutoViML commented 8 months ago

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

RNarayan73 commented 8 months ago

@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

  3. May I suggest changing version to a more pythonic-friendly scheme like 1.8.2 or 0.8.2, if that's okay.
AutoViML commented 8 months ago

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

RNarayan73 commented 8 months ago

@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
               )
AutoViML commented 8 months ago

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?

RNarayan73 commented 8 months ago

@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.

RNarayan73 commented 7 months ago

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'
AutoViML commented 6 months ago

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

RNarayan73 commented 6 months ago

@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(). https://github.com/grpc/grpc/issues/29962 https://github.com/pyinvoke/invoke/issues/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

AutoViML commented 6 months ago

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.

RNarayan73 commented 6 months ago

@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. https://github.com/AutoViML/AutoViz/issues/102#issuecomment-1873874818 https://github.com/AutoViML/AutoViz/issues/102#issuecomment-1890901228

I hope this helps.

Naraayn

maximlt commented 6 months ago

As indicated in https://github.com/AutoViML/AutoViz/issues/102#issuecomment-1890901228, 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):

https://github.com/AutoViML/AutoViz/blob/29046b6de71d7c559d2b0763a71a48a4521e0b59/setup.py#L30

@RNarayan73 you have a few solutions:

RNarayan73 commented 6 months ago

@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.

RNarayan73 commented 5 months ago

@AutoViML can you please clarify if you have any intention of maintaining your package for future versions of the various dependencies including python versions?

AutoViML commented 5 months ago

Hi @maximlt @RNarayan73 I have upgraded AutoViz to work with Python version 3.11 and 3.12 on Windows 👍 Please updgrade your AutoViz as follows

pip install autoviz --upgrade

If you see version 0.1.807, then you are in good shape Let me know Ram

RNarayan73 commented 5 months ago

@AutoViML I upgraded to v 0.1.807 and tried to get it to work in freshly created environments of Python 3.10, 3,11 & 3.12

On 3.10, I came across the issue below:

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

File ~\Python\venvs\av310\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\av310\lib\site-packages\autoviz\AutoViz_Holo.py:228, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
    226     ls_objects.append(drawobj5)
    227 if len(nums) > 0:
--> 228     drawobj6 = draw_heatmap_hv(dfin, nums, chart_format, date_vars, dep, problem_type, classes, 
    229                         mk_dir, verbose)
    230     ls_objects.append(drawobj6)
    231 if len(date_vars) > 0:

File ~\Python\venvs\av310\lib\site-packages\autoviz\AutoViz_Holo.py:1117, in draw_heatmap_hv(dft, conti, chart_format, datevars, dep, modeltype, classes, mk_dir, verbose)
   1115     dft_target = dft[:]
   1116 dft_target[dep] = dft[dep].values
-> 1117 corre = dft_target.corr()
   1118 if timeseries_flag:
   1119     heatmap = corre.hvplot.heatmap(height=height_size, width=width_size, colorbar=True, 
   1120             cmap=cmap_list, rot=70,
   1121     title='Time Series: Heatmap of all Differenced Continuous vars for target = %s' %dep)

File ~\Python\venvs\av310\lib\site-packages\pandas\core\frame.py:11036, in DataFrame.corr(self, method, min_periods, numeric_only)
  11034 cols = data.columns
  11035 idx = cols.copy()
> 11036 mat = data.to_numpy(dtype=float, na_value=np.nan, copy=False)
  11038 if method == "pearson":
  11039     correl = libalgos.nancorr(mat, minp=min_periods)

File ~\Python\venvs\av310\lib\site-packages\pandas\core\frame.py:1981, in DataFrame.to_numpy(self, dtype, copy, na_value)
   1979 if dtype is not None:
   1980     dtype = np.dtype(dtype)
-> 1981 result = self._mgr.as_array(dtype=dtype, copy=copy, na_value=na_value)
   1982 if result.dtype is not dtype:
   1983     result = np.array(result, dtype=dtype, copy=False)

File ~\Python\venvs\av310\lib\site-packages\pandas\core\internals\managers.py:1692, in BlockManager.as_array(self, dtype, copy, na_value)
   1690         arr.flags.writeable = False
   1691 else:
-> 1692     arr = self._interleave(dtype=dtype, na_value=na_value)
   1693     # The underlying data was copied within _interleave, so no need
   1694     # to further copy if copy=True or setting na_value
   1696 if na_value is lib.no_default:

File ~\Python\venvs\av310\lib\site-packages\pandas\core\internals\managers.py:1745, in BlockManager._interleave(self, dtype, na_value)
   1739 rl = blk.mgr_locs
   1740 if blk.is_extension:
   1741     # Avoid implicit conversion of extension blocks to object
   1742 
   1743     # error: Item "ndarray" of "Union[ndarray, ExtensionArray]" has no
   1744     # attribute "to_numpy"
-> 1745     arr = blk.values.to_numpy(  # type: ignore[union-attr]
   1746         dtype=dtype,
   1747         na_value=na_value,
   1748     )
   1749 else:
   1750     arr = blk.get_values(dtype)

File ~\Python\venvs\av310\lib\site-packages\pandas\core\arrays\base.py:568, in ExtensionArray.to_numpy(self, dtype, copy, na_value)
    539 def to_numpy(
    540     self,
    541     dtype: npt.DTypeLike | None = None,
    542     copy: bool = False,
    543     na_value: object = lib.no_default,
    544 ) -> np.ndarray:
    545     """
    546     Convert to a NumPy ndarray.
    547 
   (...)
    566     numpy.ndarray
    567     """
--> 568     result = np.asarray(self, dtype=dtype)
    569     if copy or na_value is not lib.no_default:
    570         result = result.copy()

File ~\Python\venvs\av310\lib\site-packages\pandas\core\arrays\_mixins.py:81, in ravel_compat.<locals>.method(self, *args, **kwargs)
     78 @wraps(meth)
     79 def method(self, *args, **kwargs):
     80     if self.ndim == 1:
---> 81         return meth(self, *args, **kwargs)
     83     flags = self._ndarray.flags
     84     flat = self.ravel("K")

File ~\Python\venvs\av310\lib\site-packages\pandas\core\arrays\categorical.py:1662, in Categorical.__array__(self, dtype)
   1660 ret = take_nd(self.categories._values, self._codes)
   1661 if dtype and np.dtype(dtype) != self.categories.dtype:
-> 1662     return np.asarray(ret, dtype)
   1663 # When we're a Categorical[ExtensionArray], like Interval,
   1664 # we need to ensure __array__ gets all the way to an
   1665 # ndarray.
   1666 return np.asarray(ret)

ValueError: could not convert string to float: 'AUDJPY.pro'

This occurs when trying to plot the heatmap for continuous features and one of my features is a string. It seems the error occurs with pandas 2.x but when downgraded to pandas 1.x the error doesn't occur. The versions installed in the 3.10 environment are: numpy 1.24.4 panda 2.2.1 holoviews 1.14.9 So, it looks like the additional code you have deployed in setup.py hasn't done anything to change versions for Python 3.10!

On 3.11, I came across the original error:

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

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

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

File ~\Python\venvs\av311\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\av311\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'

which is due to the use of holoviews 1.14.9 whereas the error has been fixed in version 1.15.3 as per @maximlt's post above. Again, the versions installed in the 3.11 environment are: numpy 1.24.4 panda 2.2.1 holoviews 1.14.9 So, it looks like the additional code you have deployed in setup.py hasn't done anything to change versions for Python 3.11 either!

As for the Python 3.12 environment, it didn't install numpy at all! I believe numpy 1.24.x isn't compatible with Python 3.12

Collecting autoviz
  Using cached autoviz-0.1.807-py3-none-any.whl.metadata (16 kB)
Collecting emoji (from autoviz)
  Using cached emoji-2.11.0-py2.py3-none-any.whl.metadata (5.3 kB)
Collecting fsspec>=0.8.3 (from autoviz)
  Using cached fsspec-2024.3.1-py3-none-any.whl.metadata (6.8 kB)
Collecting holoviews~=1.14.9 (from autoviz)
  Using cached holoviews-1.14.9-py2.py3-none-any.whl.metadata (17 kB)
Collecting hvplot~=0.7.3 (from autoviz)
  Using cached hvplot-0.7.3-py2.py3-none-any.whl.metadata (9.7 kB)
Collecting matplotlib<=3.7.4 (from autoviz)
  Using cached matplotlib-3.7.4-cp312-cp312-win_amd64.whl.metadata (5.8 kB)
Collecting nltk (from autoviz)
  Using cached nltk-3.8.1-py3-none-any.whl.metadata (2.8 kB)
Collecting numpy<1.25.0 (from autoviz)
  Using cached numpy-1.24.4.tar.gz (10.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "C:\Users\Narayan\Python\venvs\av312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\Narayan\Python\venvs\av312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Narayan\Python\venvs\av312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel
          backend = _build_backend()
                    ^^^^^^^^^^^^^^^^
        File "C:\Users\Narayan\Python\venvs\av312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
          obj = import_module(mod_path)
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Narayan\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 995, in exec_module
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "C:\Users\Narayan\AppData\Local\Temp\pip-build-env-mbwl1vlu\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
          import setuptools.version
        File "C:\Users\Narayan\AppData\Local\Temp\pip-build-env-mbwl1vlu\overlay\Lib\site-packages\setuptools\version.py", line 1, in <module>
          import pkg_resources
        File "C:\Users\Narayan\AppData\Local\Temp\pip-build-env-mbwl1vlu\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2172, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

These version checks are fairly basic checks that could be carried out after installing autoviz in a Python environment. While I'm happy to test autoviz with the correct, intended versions, I would hope that you could do the checks to see if your setup.py is working correctly to install the intended versions in the first instance.

Regards

Narayan

AutoViML commented 5 months ago

Hi @RNarayan73 Thank you so much 👍 I haven't had time to even look at these issues let alone have time to fix them and test them. Thanks for the feedback. I have fixed them properly now and it should work. Try:

pip install autoviz --upgrade

Let me know thanks a lot for your help! Auto Vimal

RNarayan73 commented 5 months ago

@AutoViML

In 3.10 envt, I compared this latest version to the previous working version that I was using 0.1.732 and in the Correlation heatmap, a number integer features have also been dropped in addition to categorical features. I think instead of dropping only categorical columns as in 0.1.732, you may have selected only the float ones! Please revert to the original approach. from v 0.1.732 image

from v 0.1.808 image

In 3.11 envt, No change and the error from my previous post still persists

In 3.12 envt, The error from my previous post still persists

AutoViML commented 4 months ago

Hi @maximlt @RNarayan73 👍 Sorry for the errors.

See my comments in latest updates page: https://github.com/AutoViML/AutoViz/blob/master/updates.md

I noticed that with pandas 2.0 and numpy >1.24 and newer python versions, the entire python ecosystem has gone for a toss. I am sorry to say but it is hitting open source developers like me hard. We now have to have different versions for different python versions. I have tried my best to maintain support for AutoViz in these trying times for python ecosystem. So please try to install directly from the github if possible to get the latest updates.

pip install git+https://github.com/AutoViML/AutoViz.git --user

For now, I have fixed your error 👍

You can check it by upgrading to autoviz version 0.1.901 as follows pip install autoviz>=0.1.901

or pip install autoviz --upgrade

Thanks AutoVimal

RNarayan73 commented 3 months ago

@AutoViML, looks like this issue is resolved. Thanks for your work!