Python 如何在使用GPU支持编译的macOS上安装Xgboost?

Python 如何在使用GPU支持编译的macOS上安装Xgboost?,python,macos,gpu,xgboost,Python,Macos,Gpu,Xgboost,我试图在我的MacOS Mojave(10.14.6)上安装与GPU支持集成的xgboost,但从过去3天开始,没有成功。我尝试了两种方法: pip安装xgboost xgboost安装在这里,它在没有GPU选项的情况下成功运行(即,没有tree_method='GPU'hist') 我想通过在树参数中指定“tree\u method='gpu\u hist'”来运行gpu\u hist。当我在树参数中给出“tree\u method='gpu\u hist'”时,出现了以下错误: XGBoos

我试图在我的MacOS Mojave(10.14.6)上安装与GPU支持集成的xgboost,但从过去3天开始,没有成功。我尝试了两种方法:

  • pip安装xgboost
  • xgboost安装在这里,它在没有GPU选项的情况下成功运行(即,没有tree_method='GPU'hist')

    我想通过在树参数中指定“tree\u method='gpu\u hist'”来运行gpu\u hist。当我在树参数中给出“tree\u method='gpu\u hist'”时,出现了以下错误:

    XGBoostError: [12:10:34] /Users/travis/build/dmlc/xgboost/src/gbm/../common/common.h:153: XGBoost version not compiled with GPU support.
    Stack trace:
    [bt] (0) 1 libxgboost.dylib 0x000000012256ba60 dmlc::LogMessageFatal::~LogMessageFatal() + 112
    [bt] (1) 2 libxgboost.dylib 0x00000001225f92b3 xgboost::gbm::GBTree::ConfigureUpdaters() + 531
    [bt] (2) 3 libxgboost.dylib 0x00000001225f8b97 xgboost::gbm::GBTree::Configure(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&) + 967
    [bt] (3) 4 libxgboost.dylib 0x0000000122611a0c xgboost::LearnerConfiguration::Configure() + 1500
    [bt] (4) 5 libxgboost.dylib 0x0000000122611e68 xgboost::LearnerImpl::UpdateOneIter(int, std::__1::shared_ptr) + 120
    [bt] (5) 6 libxgboost.dylib 0x000000012256331d XGBoosterUpdateOneIter + 157
    [bt] (6) 7 libffi.7.dylib 0x0000000102102ead ffi_call_unix64 + 85
    [bt] (7) 8 ??? 0x00007ffeee291da0 0x0 + 140732894092704
    
    xgboost:[12:10:34]/Users/travis/build/dmlc/xgboost/src/gbm/。/common/common.h:153:xgboost版本未使用GPU支持编译。
    堆栈跟踪:
    [bt](0)1 libxgboost.dylib 0x000000012256ba60 dmlc::LogMessageFatal::~LogMessageFatal()+112
    [bt](1)2 libxgboost.dylib 0x00000001225f92b3 xgboost::gbm::GBTree::ConfigureUpdaters()+531
    [bt](2)3 libxgboost.dylib 0x00000001225f8b97 xgboost::gbm::GBTree::Configure(std::u 1::vector const&)+967
    [bt](3)4 libxgboost.dylib 0x000000012261a0c xgboost::LearnerConfiguration::Configure()+1500
    [bt](4)5 libxgboost.dylib 0x000000012261E68 xgboost::LearnerImpl::UpdateOneIter(int,std::u 1::shared_ptr)+120
    [bt](5)6 libxgboost.dylib 0x000000012256331d XGBoosterUpdateOneIter+157
    [bt](6)7 libffi.7.dylib 0x0000000102102ead ffi_call_unix64+85
    [bt](7)8???0x00007FFEE291DA0 0x0+140732894092704
    
  • 我的第二种方法:

    git克隆-递归 cd xgboost/ make-j4 cd python包 python3 setup.py安装

    虽然它安装了xgboost,但在运行此语句时抛出以下错误: dtrain=xgb.DMatrix(df_train_特征,标签=df_train_标签),缺失=-999)

    属性错误:dlsym(0x7ffe9aed62f0,XGDMatrixSetDenseInfo):未找到符号


  • 任何帮助都将不胜感激

    由于过时的
    libxgboost,我也遇到了同样的情况。因此
    在新的安装过程中没有更新

    要解决此问题并使用GPU支持安装
    xgboost
    ,您应该执行以下操作:

    # remove libxgboost.so manually from where it resides
    rm /home/$USER/anaconda3/lib/libxgboost.so 
    pip uninstall -y xgboost 
    git clone --recursive https://github.com/dmlc/xgboost
    cd xgboost && mkdir build && cd build && cmake .. -DUSE_CUDA=ON
    make -j12
    cd ../python-package
    python setup.py install