0

I am trying to install XGBoost on a EC2 instance and continually get the following error after trying "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/

I am using the latest version of Anaconda (Linux). I have tried using miniconda and installing all the need packages with no success. Additionally, I have tried all of the suggestions that I found here.

Any suggestions / solutions are much appreciated.

Greg
  • 602
  • 2
  • 7
  • 15

1 Answers1

5

You are missing the g++ compiler.

You did not mention which Linux that you are running.

Amazon Linux:

yum install make glibc-devel gcc patch

John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • Thank you for the suggestion, I tried it said I need to be a root user. I am working on resolving this now. – Greg Nov 15 '17 at 20:51
  • Thanks again for trying to help me but I tried added sudo to the front of the command and go the same error. I then ran "sudo su" and tried installing again, same error. The linux version is "Amazon Linux AMI 2017.09.1 (HVM), SSD Volume Type". The very first one on the list. – Greg Nov 15 '17 at 21:13
  • If you type "sudo yum install make glibc-devel gcc patch" what is the exact error? Instead of "sudo su" you type "sudo sh" to open a shell with root privileges. – John Hanley Nov 15 '17 at 21:15
  • sh-4.2# sudo yum install make glibc-devel gcc patch Loaded plugins: priorities, update-motd, upgrade-helper Package 1:make-3.82-21.10.amzn1.x86_64 already installed and latest version Package glibc-devel-2.17-196.172.amzn1.x86_64 already installed and latest version Package gcc-4.8.5-1.22.amzn1.noarch already installed and latest version Package patch-2.7.1-8.9.amzn1.x86_64 already installed and latest version Nothing to do sh-4.2# – Greg Nov 15 '17 at 21:18
  • 1
    Try "sudo yum install gcc-c++" or "sudo yum groupinstall "Development Tools"" – John Hanley Nov 15 '17 at 21:24
  • I think I may give up on this. I am running the t2.micro instance. Does that have any bearing on this? – Greg Nov 15 '17 at 21:41
  • No, not unless you are running out of disk space. Your problem is this: you do not have the C++ development environment installed. This will be the same issue no matter what instance size you pick. – John Hanley Nov 15 '17 at 21:59