【E-17-Xgboost安装】AttributeError: module 'xgboost' has no attribute 'DMatrix'

一、问题源头

调用出错:在docker上根据官网和网站上提示安装了GPU的Xgboost,但是提示以下错误:

git clone --recursive https://github.com/dmlc/xgboost

cd xgboost

   

$ mkdir build

$ cd build

$ cmake .. -DUSE_CUDA=ON

$ make -j

   

   

二、原因

没有指定路径,python找不到xgboost。

以下两种处理方式都会引发新问题(KernelRestarter: restarting kernel (1/5)),不建议使用,本次只做一下记录。

   

处理方式一:

https://stackoverflow.com/questions/46010755/module-xgboost-has-no-attribute-dmatrix

   

处理方式二:

再进入python-package运行python setup.py install

https://blog.csdn.net/weixin_43836548/article/details/105216451

   

三、解决方案

   

本文采用

还是放弃GPU的方式,直接到cpu

   

四、建议

后面再尝试GPU安装,待续。。。

原文地址:https://www.cnblogs.com/yifanrensheng/p/13946201.html