anthony-wang / BestPractices

Things that you should (and should not) do in your Materials Informatics research.
https://doi.org/10.1021/acs.chemmater.0c01907
MIT License
178 stars 76 forks source link

pandas-profile import incompatibility with pandas #11

Open sgbaird opened 2 years ago

sgbaird commented 2 years ago

Related: https://stackoverflow.com/questions/68704002/importerror-cannot-import-name-abcindexclass-from-pandas-core-dtypes-generic

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_34576\424347616.py in <module>
      6 get_ipython().run_line_magic('config', "InlineBackend.figure_format='retina'")
      7 
----> 8 from pandas_profiling import ProfileReport

~\Miniconda3\envs\bestpractices\lib\site-packages\pandas_profiling\__init__.py in <module>
      5 
      6 from pandas_profiling.config import Config, config
----> 7 from pandas_profiling.controller import pandas_decorator
      8 from pandas_profiling.profile_report import ProfileReport
      9 from pandas_profiling.version import __version__

~\Miniconda3\envs\bestpractices\lib\site-packages\pandas_profiling\controller\pandas_decorator.py in <module>
      2 from pandas import DataFrame
      3 
----> 4 from pandas_profiling.__init__ import ProfileReport
      5 
      6 

~\Miniconda3\envs\bestpractices\lib\site-packages\pandas_profiling\__init__.py in <module>
      6 from pandas_profiling.config import Config, config
      7 from pandas_profiling.controller import pandas_decorator
----> 8 from pandas_profiling.profile_report import ProfileReport
      9 from pandas_profiling.version import __version__
     10 

~\Miniconda3\envs\bestpractices\lib\site-packages\pandas_profiling\profile_report.py in <module>
      9 
     10 from pandas_profiling.config import config
---> 11 from pandas_profiling.model.describe import describe as describe_df
     12 from pandas_profiling.model.messages import MessageType
     13 from pandas_profiling.report import get_report_structure

~\Miniconda3\envs\bestpractices\lib\site-packages\pandas_profiling\model\describe.py in <module>
      9 from pandas_profiling.model.base import Variable
     10 from pandas_profiling.model.correlations import calculate_correlation
---> 11 from pandas_profiling.model.summary import (
     12     get_duplicates,
     13     get_messages,

~\Miniconda3\envs\bestpractices\lib\site-packages\pandas_profiling\model\summary.py in <module>
     11 import pandas as pd
     12 from scipy.stats.stats import chisquare
---> 13 from visions.application.summaries.series import (
     14     file_summary,
     15     image_summary,

~\Miniconda3\envs\bestpractices\lib\site-packages\visions\__init__.py in <module>
      2 from visions import utils
      3 
----> 4 from visions.dtypes.boolean import BoolDtype
      5 
      6 from visions import types, typesets

~\Miniconda3\envs\bestpractices\lib\site-packages\visions\dtypes\boolean.py in <module>
     22 )
     23 from pandas.core.dtypes.dtypes import register_extension_dtype
---> 24 from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries
     25 from pandas.core.dtypes.missing import isna, notna
     26 

ImportError: cannot import name 'ABCIndexClass' from 'pandas.core.dtypes.generic' (C:\Users\sterg\AppData\Roaming\Python\Python37\site-packages\pandas\core\dtypes\generic.py)
lorcan2440 commented 1 year ago

Hi, any updates on this? I am having a very similar issue. In my case the error is

ImportError: cannot import name 'Correlation' from 'pandas_profiling.config' (c:\Users\lnick\anaconda3\envs\AllLibs310\lib\site-packages\pandas_profiling\config.py)

but it changes with every downgrade or upgrade I try to resolve it with :/

sgbaird commented 1 year ago

Hi @lorcan2440, sorry no update on my end. I probably won't be able to circle back to this for a while. @anthony-wang is this something you could take a look at? My other suggestion would be to try running it via WSL (e.g., with VS Code so you can still open up Jupyter notebooks like normal)

janash commented 1 year ago

I commented on this earlier and realized it was actually a different problem than I was experiencing.

I've installed from the conda-env.yml on both Windows and WSL and haven't experienced the issue reported above. What operating system are both of you using / what are the other details of installation? Did the notebook checking the dependencies (0b-check_dependencies.ipynb) run okay?

I had a problem with the version of jinja2 (I have a PR for that now - #12 ), but after I fixed that, I haven't seen other problems. Where did this problem occur? (what notebook?)

If you switch to WSL you might encounter issue #13

lorcan2440 commented 1 year ago

I ended up just fully uninstalling and reinstalling and it works now. My versions are Python 3.10.0 Pandas=1.5.2 Pandas-profiling=3.6.2 It worked both in vscode and in jupyter.