导入错误:找不到 IProgress。尽管已安装,但请更新 jupyter 和 ipywidgets

2024-01-06

我正在使用 jupyter 笔记本并安装。

ipywidgets==7.4.2 widgetsnbextension pandas-profiling=='.0.0

我也跑了:

!jupyter nbextension enable --py widgetsnbextension

但运行时:

from pandas_profiling import ProfileReport
profile = ProfileReport(df, title="Pandas Profiling Report", explorative=True)
profile.to_widgets()

我收到错误:

ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html

知道为什么吗? 尝试了建议的解决方案。


我在新环境中尝试了你提到的所有内容conda我还有另一个与版本相关的问题ipywidgets(在 Github 上发现的一个错误,评论说使用上一个版本后已解决)。我解决了安装最新版本时遇到的问题ipywidgets。这是我的过程:

  1. 使用创建新环境conda(我使用迷你康达):
conda create --name teststackoverflow python=3.7
  1. 激活新环境:
conda activate teststackoverflow
  1. Install jupyter:
pip install jupyter
  1. 安装所有没有特定版本的库以获取最新版本:
pip install ipywidgets widgetsnbextension pandas-profiling
  1. Run jupyter notebook在控制台中打开笔记本服务器并创建一个新笔记本。
  2. 在新单元格中运行此行:
!jupyter nbextension enable --py widgetsnbextension

结果是:

Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: OK
  1. 运行一些示例代码来定义df:
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [1, 2, 3, 4]})
  1. 运行您提供的代码:
from pandas_profiling import ProfileReport
profile = ProfileReport(df, title="Pandas Profiling Report", explorative=True)
profile.to_widgets()

Final output looks good: Final result of running step number 8

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

导入错误:找不到 IProgress。尽管已安装,但请更新 jupyter 和 ipywidgets 的相关文章

随机推荐