美文网首页
MacOS上安装xgboost

MacOS上安装xgboost

作者: 小甜瓜Melon | 来源:发表于2017-08-29 15:54 被阅读0次

    第一步、尝试pip install xgboost

    MacBook-Pro:~/jupyter_local/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
        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
        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
        make: *** [build/learner.o] Error 127
        make: *** Waiting for unfinished jobs....
        /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/rz/h1wlyyzx5_53hdlg7lpk2bwc0000gn/T/pip-build-CbVSFW/xgboost/setup.py", line 29, in <module>
            LIB_PATH = libpath['find_lib_path']()
          File "/private/var/folders/rz/h1wlyyzx5_53hdlg7lpk2bwc0000gn/T/pip-build-CbVSFW/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:
        /private/var/folders/rz/h1wlyyzx5_53hdlg7lpk2bwc0000gn/T/pip-build-CbVSFW/xgboost/xgboost/libxgboost.so
        /private/var/folders/rz/h1wlyyzx5_53hdlg7lpk2bwc0000gn/T/pip-build-CbVSFW/xgboost/xgboost/../../lib/libxgboost.so
        /private/var/folders/rz/h1wlyyzx5_53hdlg7lpk2bwc0000gn/T/pip-build-CbVSFW/xgboost/xgboost/./lib/libxgboost.so
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/rz/h1wlyyzx5_53hdlg7lpk2bwc0000gn/T/pip-build-CbVSFW/xgboost/
    

    报错!

    第二步、尝试conda安装

    MacBook-Pro:~/jupyter_local/xgboost$ conda install xgboost

    Fetching package metadata .........
    
    PackageNotFoundError: Package missing in current osx-64 channels:
      - xgboost
    
    Close matches found; did you mean one of these?
    
        xgboost: r-xgboost, boost, py-xgboost
    

    第三步、尝试conda install py-xgboost

    MacBook-Pro:~/jupyter_local/xgboost$ conda install py-xgboost

    Fetching package metadata .........
    Solving package specifications: .
    
    Package plan for installation in environment /Users/terrence/anaconda:
    
    The following NEW packages will be INSTALLED:
    
        libgcc:     4.8.5-1
        libxgboost: 0.60-h8fd8b8a_0
        py-xgboost: 0.60-py27np112hf8e804c_0
    
    The following packages will be UPDATED:
    
        conda:      4.3.21-py27_0            --> 4.3.25-py27_0
    
    Proceed ([y]/n)? y
    
    libgcc-4.8.5-1 100% |#####################################################################################################################################| Time: 0:00:01 616.78 kB/s
    libxgboost-0.6 100% |#####################################################################################################################################| Time: 0:00:02 752.48 kB/s
    py-xgboost-0.6 100% |#####################################################################################################################################| Time: 0:00:00 570.01 kB/s
    conda-4.3.25-p 100% |#####################################################################################################################################| Time: 0:00:00 522.97 kB/s
    

    测试,安装成功!


    比较常规的方法是
    参考xgboost官网

    相关文章

      网友评论

          本文标题:MacOS上安装xgboost

          本文链接:https://www.haomeiwen.com/subject/nunodxtx.html