How to install xgboost package in python (windows platform)?

Robin1988 picture Robin1988 · Nov 17, 2015 · Viewed 95.8k times · Source

http://xgboost.readthedocs.org/en/latest/python/python_intro.html

On the homepage of xgboost(above link), it says: To install XGBoost, do the following steps:

  1. You need to run make in the root directory of the project

  2. In the python-package directory run

    python setup.py install

However, when I did it, for step 1 the following error appear: make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

then I skip step1 and did step 2 directly, another error appear:

Traceback (most recent call last):
  File "setup.py", line 19, in <module>
    LIB_PATH = libpath['find_lib_path']()
  File "xgboost/libpath.py", line 44, 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?

Does anyone know how to install xgboost for python on Windows10 platform? Thanks for your help!

Answer

brettlyman picture brettlyman · Oct 1, 2016

In case anyone's looking for a simpler solution that doesn't require compiling it yourself:

  1. download xgboost whl file from here (make sure to match your python version and system architecture, e.g. "xgboost-0.6-cp35-cp35m-win_amd64.whl" for python 3.5 on 64-bit machine)
  2. open command prompt
  3. cd to your Downloads folder (or wherever you saved the whl file)
  4. pip install xgboost-0.6-cp35-cp35m-win_amd64.whl (or whatever your whl file is named)

If you find it won't install because of a missing dependency, download and install the dependency first and retry.

If it complains about access permissions, try opening your command prompt as Administrator and retry.

This gives you xgboost and the scikit-learn wrapper, and saves you from having to go through the pain of compiling it yourself. :)