python - 在 EC2 上安装 XGBoost

标签 python linux amazon-web-services amazon-ec2 xgboost

我正在尝试在 EC2 实例上安装 XGBoost,并在尝试“pip install xgboost”后不断收到以下错误:

> Collecting xgboost
  Using cached xgboost-0.6a2.tar.gz
    Complete output from command python setup.py egg_info:
    rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
    g++ -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
    g++ -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: g++: command not found
    make: *** [build/logging.o] Error 127
    make: *** Waiting for unfinished jobs....
    g++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/common/common.o src/common/common.cc >build/common/common.d
    /bin/sh: g++: command not found
    make: *** [build/learner.o] Error 127
    /bin/sh: g++: command not found
    make: *** [build/common/common.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
    g++ -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
    g++ -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: g++: command not found
    make: *** [build/logging.o] Error 127
    make: *** Waiting for unfinished jobs....
    g++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/common/common.o src/common/common.cc >build/common/common.d
    /bin/sh: g++: command not found
    make: *** [build/learner.o] Error 127
    /bin/sh: g++: command not found
    make: *** [build/common/common.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 "/tmp/pip-build-TkrTN6/xgboost/setup.py", line 29, in <module>
        LIB_PATH = libpath['find_lib_path']()
      File "/tmp/pip-build-TkrTN6/xgboost/xgboost/libpath.py", line 45, in find_lib_path
        'List of candidates:\n' + ('\n'.join(dll_path)))
    __builtin__.XGBoostLibraryNotFound: Cannot find XGBoost Libarary in the candicate path, did you install compilers and run build.sh in root path?
    List of candidates:
    /tmp/pip-build-TkrTN6/xgboost/xgboost/libxgboost.so
    /tmp/pip-build-TkrTN6/xgboost/xgboost/../../lib/libxgboost.so
    /tmp/pip-build-TkrTN6/xgboost/xgboost/./lib/libxgboost.so

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-TkrTN6/xgboost/

我正在使用最新版本的 Anaconda (Linux)。我试过使用 miniconda 并安装所有需要的包但没有成功。此外,我已经尝试了我发现的所有建议 here .

非常感谢任何建议/解决方案。

最佳答案

您缺少 g++ 编译器。

你没有提到你运行的是哪个 Linux。

亚马逊 Linux:

yum install make glibc-devel gcc patch

关于python - 在 EC2 上安装 XGBoost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47312458/

相关文章:

linux - Ubuntu:安装最新版本的软件包

linux - 复制选定的文件

c# - AWS API : how to cast dynamo result as class

python - 在用户定义的函数中使用模块

python - 你如何使用 scipy.stats.rv_continuous?

python - Tkinter Linux 版本 "<Control-Shift-u>"

amazon-web-services - Lambda 并发数未按预期增加

python - 为什么我的 venv 使用的 pip 版本与我安装的不同

python - Kubernetes API 服务器

amazon-web-services - KAFKA 代理抛出错误的请求类型 18 和错误的请求类型 16