【问题标题】:```pipdeptree --reverse --packages xgboost``` - how to resovle library incompatibility```pipdeptree --reverse --packages xgboost``` - 如何解决库不兼容问题
【发布时间】:2021-02-20 15:13:27
【问题描述】:

目标

  • 我的最终目标是在 conda 环境中本地运行这个 kaggle 项目。
  • 我在 Ubuntu 20.04 LTS、conda 环境、python 3.8 上运行它

输入

  • 建议我运行 this 代码,因为我有库依赖问题。
pipdeptree --reverse --packages xgboost

输出

Warning!!! Possibly conflicting dependencies found:
* wandb==0.10.4
 - subprocess32 [required: >=3.5.3, installed: ?]
* spyder==4.1.5
 - pyqt5 [required: <5.13, installed: ?]
 - pyqtwebengine [required: <5.13, installed: ?]
* QDarkStyle==2.8.1
 - helpdev [required: >=0.6.10, installed: ?]
* Flask-Compress==1.5.0
 - brotli [required: Any, installed: ?]
* dask-xgboost==0.1.11
 - xgboost [required: <=0.90, installed: 1.2.0]
* dash==1.16.3
 - dash-core-components [required: ==1.12.1, installed: 1.3.1]
 - dash-html-components [required: ==1.1.1, installed: 1.0.1]
 - dash-renderer [required: ==1.8.2, installed: 1.1.2]
 - dash-table [required: ==4.10.1, installed: 4.4.1]
------------------------------------------------------------------------
xgboost==1.2.0
  - dask-xgboost==0.1.11 [requires: xgboost<=0.90]

更新

现在我已经重新安装了 XGBoost 和

conda install -c conda-forge xgboost

当我在 jupyter 中运行我的代码导入时,它会说

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-f5a95d2c9926> in <module>
      3 from dask.distributed import Client
      4 from dask import array as da
----> 5 import xgboost as xgb
      6 from xgboost import dask as dxgb
      7 from xgboost.dask import DaskDMatrix

ModuleNotFoundError: No module named 'xgboost'

【问题讨论】:

    标签: python anaconda conda xgboost kaggle


    【解决方案1】:

    如果你创建一个新的 conda 环境,你会得到同样的错误吗?例如

    conda create -n kaggle_xgboost_test python=3.8 pandas numpy scikit-learn xgboost jupyter
    conda activate kaggle_xgboost_test
    
    # Then open a notebook
    jupyter-notebook
    
    # And try to import xgboost with e.g.
    import xgboost
    print("imported ok")
    

    编辑

    如果新环境安装/导入 xgboost 没有任何问题(如您的评论所示),那么您遇到的问题是您现有环境所独有的。您是否解决了pipdeptree --reverse --packages xgboost 标识的冲突?你试过building xgboost from source with GPU support enabled吗?例如

    git clone --recursive https://github.com/dmlc/xgboost
    cd xgboost
    mkdir build
    cd build
    cmake .. -DUSE_CUDA=ON
    make -j4
    

    【讨论】:

    • 在其他环境中这不是问题,但问题是我在这里重新安装了 xgboost,如果我调用 conda list 而不是 xgboost ist ehre 和 py-xgboost 也是如此,但导入说它不是那里。 (我已经检查过我正在使用正确的笔记本 url 查看正确的环境)。目标是在 kaggle 项目中获得支持在 GPU (Nvidia) 上运行的 xgboost
    猜你喜欢
    • 2021-06-24
    • 2014-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-16
    • 1970-01-01
    • 2023-01-13
    相关资源
    最近更新 更多