无法在 Windows 10 上的 Jupyter 笔记本中导入 Lightgbm

Unable to import Lightgbm in Jupyter notebook on Windows 10

提问人:Ankita 提问时间:11/6/2023 更新时间:11/7/2023 访问量:27

问:

我可以使用以下命令安装 Lightgbm:

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org lightgbm

我也能够看到它通过使用 Conda 列表安装。

但是,在那之后,我无法将包导入Jupyter notebook。

我收到以下错误。

导入 LightGBM

AttributeError:模块“pandas.core.strings”没有属性“StringMethods”

我尝试了上述方法,但徒劳无功。还有许多其他错误行表明dask.dataframe错误,我无法找到解决方法。

蟒蛇 python-3.x conda lightgbm gbm

评论


答:

0赞 James Lamb 11/7/2023 #1

microsoft/LightGBM#5379 中所述,与 不兼容。dask<2023.2.0pandas>=2.0

虽然您没有包含诸如 或 的输出之类的详细信息,但我强烈怀疑您有这些库的此类版本。conda-env exportpip freeze

要么从您的环境中删除...dask

pip uninstall --yes \
    dask

...或将其升级到更新的版本distributed

pip install \
    'dask>2023.3.2' \
    'distributed>2023.3.2'

完成其中一项操作后,重新启动笔记本的内核,您应该能够导入而不会遇到此问题。lightgbm

import lightgbm