ydataai / ydata-profiling

1 Line of code data quality profiling & exploratory data analysis for Pandas and Spark DataFrames.
https://docs.profiling.ydata.ai
MIT License
12.53k stars 1.68k forks source link

AttributeError: module 'ipywidgets.widgets' has no attribute 'GridBox' #805

Open belisards opened 3 years ago

belisards commented 3 years ago

Describe the bug When I try to generate a report I get this error:


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/lib/python3/dist-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/.local/lib/python3.9/site-packages/pandas_profiling/profile_report.py in _repr_html_(self)
    420     def _repr_html_(self) -> None:
    421         """The ipython notebook widgets user interface gets called by the jupyter notebook."""
--> 422         self.to_notebook_iframe()
    423 
    424     def __repr__(self) -> str:

~/.local/lib/python3.9/site-packages/pandas_profiling/profile_report.py in to_notebook_iframe(self)
    393         from IPython.core.display import display
    394 
--> 395         from pandas_profiling.report.presentation.flavours.widget.notebook import (
    396             get_notebook_iframe,
    397         )

~/.local/lib/python3.9/site-packages/pandas_profiling/report/presentation/flavours/widget/__init__.py in <module>
      1 from pandas_profiling.report.presentation.flavours.widget.collapse import WidgetCollapse
----> 2 from pandas_profiling.report.presentation.flavours.widget.container import (
      3     WidgetContainer,
      4 )
      5 from pandas_profiling.report.presentation.flavours.widget.duplicate import (

~/.local/lib/python3.9/site-packages/pandas_profiling/report/presentation/flavours/widget/container.py in <module>
     43 
     44 
---> 45 def get_row(items: List[Renderable]) -> widgets.GridBox:
     46     if len(items) == 1:
     47         layout = widgets.Layout(width="100%", grid_template_columns="100%")
**AttributeError: module 'ipywidgets.widgets' has no attribute 'GridBox'**

To Reproduce

Data:


import pandas as pd
df = pd.read_csv('https://github.com/syntagmatic/gapminder-csv/raw/master/gapminder.csv')

Code:

profile = ProfileReport(df, title="Pandas Profiling Report")
profile

Version information:

OS: Ubuntu Python: 3.9.5 IDE: Jupyter Notebook and Visual Studio Code

Click to expand Version information

appdirs==1.4.4 apturl==0.5.2 argon2-cffi==18.3.0 attrs==20.3.0 backcall==0.2.0 bcrypt==3.1.7 beautifulsoup4==4.9.3 bleach==3.2.1 blinker==1.4 Bottleneck==1.2.1 Brlapi==0.8.2 certifi==2020.6.20 chardet==4.0.0 chrome-gnome-shell==0.0.0 click==7.1.2 colorama==0.4.4 command-not-found==0.3 cryptography==3.3.2 cupshelpers==1.0 cycler==0.10.0 dbus-python==1.2.16 decorator==4.4.2 defer==1.0.6 defusedxml==0.6.0 distlib==0.3.1 distro==1.5.0 distro-info==1.0 duplicity==0.8.17 entrypoints==0.3 et-xmlfile==1.1.0 fasteners==0.14.1 filelock==3.0.12 future==0.18.2 GDAL==3.2.2 html5lib==1.1 htmlmin==0.1.12 httplib2==0.18.1 idna==2.10 ImageHash==4.2.0 importlib-metadata==1.6.0 iniconfig==0.0.0 ipykernel==5.4.3 ipython==7.20.0 ipython-genutils==0.2.0 ipywidgets==6.0.0 jdcal==1.0 jedi==0.18.0 jeepney==0.6.0 Jinja2==2.11.2 joblib==1.0.1 jsonschema==3.2.0 jupyter-client==6.1.11 jupyter-console==6.2.0 jupyter-core==4.7.1 keyring==22.2.0 kiwisolver==1.3.1 language-selector==0.1 launchpadlib==1.10.13 lazr.restfulclient==0.14.2 lazr.uri==1.0.5 llvmlite==0.35.0 lockfile==0.12.2 louis==3.16.0 lxml==4.6.3 macaroonbakery==1.3.1 Mako==1.1.3 MarkupSafe==1.1.1 matplotlib==3.4.2 missingno==0.4.2 mistune==0.8.4 monotonic==1.5 more-itertools==4.2.0 multimethod==1.4 nbconvert==5.6.1 nbformat==5.1.2 netifaces==0.10.9 networkx==2.5.1 notebook==6.2.0 numba==0.52.0 numexpr==2.7.2 numpy==1.20.3 oauthlib==3.1.0 odfpy==1.4.1 olefile==0.46 openpyxl==3.0.7 OWSLib==0.23.0 packaging==20.9 PAM==0.4.2 pandas==1.2.5 pandas-profiling==3.0.0 pandocfilters==1.4.3 paramiko==2.7.2 parso==0.8.1 pexpect==4.8.0 phik==0.11.2 pickleshare==0.7.5 Pillow==8.1.2 pipenv==11.9.0 plotly==4.14.3 pluggy==0.13.0 prometheus-client==0.9.0 prompt-toolkit==3.0.14 protobuf==3.12.4 psycopg2==2.8.6 py==1.10.0 pycairo==1.16.2 pycups==2.0.1 pydantic==1.8.2 Pygments==2.7.1 PyGObject==3.38.0 PyICU==2.5 PyJWT==1.7.1 pymacaroons==0.13.0 PyNaCl==1.4.0 pyparsing==2.4.7 pyproj==3.0.0 PyQt5==5.15.4 PyQt5-sip==12.8.1 pyRFC3339==1.1 pyrsistent==0.15.5 pytest==6.0.2 python-apt==2.1.7+ubuntu2 python-dateutil==2.8.1 python-debian==0.1.39 python-dotenv==0.17.1 pytz==2021.1 PyWavelets==1.1.1 pyxdg==0.27 PyYAML==5.3.1 pyzmq==20.0.0 QScintilla==2.11.6 reportlab==3.5.66 requests==2.25.1 retrying==1.3.3 scipy==1.6.0 seaborn==0.11.1 SecretStorage==3.3.1 Send2Trash==1.6.0b1 simplejson==3.17.2 six==1.15.0 soupsieve==2.2 systemd-python==234 tables==3.6.1 tangled-up-in-unicode==0.1.0 terminado==0.9.2 testpath==0.4.4 toml==0.10.1 tornado==6.1 tqdm==4.61.1 traitlets==5.0.5 typing-extensions==3.10.0.0 ubuntu-advantage-tools==24.4 ubuntu-drivers-common==0.0.0 ufw==0.36 unattended-upgrades==0.1 urllib3==1.26.2 usb-creator==0.3.7 virtualenv==20.4.0+ds virtualenv-clone==0.3.0 visions==0.7.1 wadllib==1.3.5 wcwidth==0.1.9 webencodings==0.5.1 widgetsnbextension==2.0.0 xdg==5 xkit==0.0.0 xlrd==2.0.1 xlwt==1.3.0 zipp==1.0.0

Additional context

chordx1206 commented 3 years ago

Hello, I have the same problem. have you solved this problem?

belisards commented 3 years ago

@chordx1206 unfortunately, not yet.

sbrugman commented 3 years ago

What happens if you upgrade ipywidgets? pip install -U ipywidgets (and restart the environment)

matindra commented 1 year ago

Same issue here. Anyone found the solution?

hiraking commented 1 year ago

I had the same problem on WSL Ubuntu and solved it as follows.

My ipywidgets version is 8.0.4 according to pip, but I noticed that the acutual imported version was 6.0.0. So I removed the older version of the package (which in my case existed under /usr/lib/python3/dist-packages) and that worked.

Hope this helps.