首页 > 解决方案 > 在 Mac Mojave 上安装 xgboost==0.6a2

问题描述

我已经尝试了所有可以在网上找到的解决方案来安装 xgboost==0.6a2

我有 MacOS Mojave 10.14.4

我正在尝试使用具有 python 3.6 的 virtualenv

这是 pip 命令的结果

pip install xgboost==0.6a2
Collecting xgboost==0.6a2
  Using cached https://files.pythonhosted.org/packages/34/85/456a1a8c762f646671043e446a59efbce02b5f408f522c4ef8793e860c5e/xgboost-0.6a2.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
    clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
    /bin/sh: clang-omp++: command not found
    make: *** [build/learner.o] Error 127
    make: *** Waiting for unfinished jobs....
    clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/logging.o src/logging.cc >build/logging.d
    /bin/sh: clang-omp++: command not found
    make: *** [build/logging.o] Error 127
    -----------------------------
    Building multi-thread xgboost failed
    Start to build single-thread xgboost
    rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
    clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
    /bin/sh: clang-omp++: command not found
    make: *** [build/learner.o] Error 127
    make: *** Waiting for unfinished jobs....
    clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/logging.o src/logging.cc >build/logging.d
    /bin/sh: clang-omp++: command not found
    make: *** [build/logging.o] Error 127
    Successfully build single-thread xgboost
    If you want multi-threaded version
    See additional instructions in doc/build.md
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/setup.py", line 29, in <module>
        LIB_PATH = libpath['find_lib_path']()
      File "/private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/xgboost/libpath.py", line 45, in find_lib_path
        'List of candidates:\n' + ('\n'.join(dll_path)))
    XGBoostLibraryNotFound: Cannot find XGBoost Libarary in the candicate path, did you install compilers and run build.sh in root path?
    List of candidates:
    /private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/xgboost/libxgboost.so
    /private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/xgboost/../../lib/libxgboost.so
    /private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/xgboost/./lib/libxgboost.so
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/

我下载了 xgboost 并尝试从源代码安装

python setup.py install
rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
/bin/sh: clang-omp++: command not found
make: *** [build/learner.o] Error 127
make: *** Waiting for unfinished jobs....
clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/logging.o src/logging.cc >build/logging.d
/bin/sh: clang-omp++: command not found
make: *** [build/logging.o] Error 127
-----------------------------
Building multi-thread xgboost failed
Start to build single-thread xgboost
rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
/bin/sh: clang-omp++: command not found
make: *** [build/learner.o] Error 127
make: *** Waiting for unfinished jobs....
clang-omp++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/logging.o src/logging.cc >build/logging.d
/bin/sh: clang-omp++: command not found
make: *** [build/logging.o] Error 127
Successfully build single-thread xgboost
If you want multi-threaded version
See additional instructions in doc/build.md
Traceback (most recent call last):
  File "setup.py", line 29, in <module>
    LIB_PATH = libpath['find_lib_path']()
  File "xgboost/libpath.py", line 45, in find_lib_path
    'List of candidates:\n' + ('\n'.join(dll_path)))
XGBoostLibraryNotFound: Cannot find XGBoost Libarary in the candicate path, did you install compilers and run build.sh in root path?
List of candidates:
/Users/karim/Documents/software/xgboost-0.6a2/xgboost/libxgboost.so
/Users/karim/Documents/software/xgboost-0.6a2/xgboost/../../lib/libxgboost.so
/Users/karim/Documents/software/xgboost-0.6a2/xgboost/./lib/libxgboost.so

我也尝试通过安装 gcc5

酿造安装 gcc@5

这使

错误:gcc@5 5.5.0_2 已安装

当我输入gcc -v它给

配置: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM 版本 10.0.1 (clang-1001.0.46.4) 目标:x86_64-apple-darwin18.5.0 线程模型:posix InstalledDir:/Library/Developer/CommandLineTools/usr/bin

在 Mac 上是否有任何特定的步骤来配置它?

任何帮助高度赞赏。

标签: pythonmacosxgboost

解决方案


I think having

ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8s/jbryfvkn68jg4d2p2mncgqqw0000gq/T/pip-install-bp2gsdf9/xgboost/ 

mean that your setuptools are out of date. You can fix it by doing :

pip install --upgrade setuptools

推荐阅读