Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Machine Learning by (19k points)

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

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

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 appears:

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!

1 Answer

0 votes
by (33.1k points)
edited by

XGBoost is basically written in C++. We need the Cmake library for conversion to Python. You can try these steps for a newer version of XGBoost:

Step 1.

Install cmake https://cmake.org/download/

Verify cmake have been installed successfully

$ cmake

Usage

cmake [options] <path-to-source>

cmake [options] <path-to-existing-build>

...

Step 2.

Clone xgboost source

$ git clone https://github.com/dmlc/xgboost xgboost_dir

Step 3. Create Visual Studio Project

$ cd xgboost_dir

$ mkdir build

$ cd build

$ cmake .. -G"Visual Studio 12 2013 Win64"

Step 4. Build the Visual Studio 2013 project

  1. Open file xgboost_dir/build/ALL_BUILD.vcxproj with Visual Studio 2013
  2. In Visual Studio 2013, open BUILD > Configuration Manager...
  3. choose Release in Active solution configuration
  4. choose x64 in Active solution platform
  5. Click BUILD > Build Solution (Ctrl + Shift +B)

After build solution, two new files libxgboost.dll and xgboost.exe are created in folder xgboost_dir/lib

Step 5. Build a python package

  1. Copy file libxgboost.dll to xgboost_dir/python-package
  2. Change directory to xgboost_dir/python-package folder
  3. Run command python setup.py install
  4. Verify xgboost have been installed successfully

Hope this answer helps.

If you want to learn  Python for Data Science then you can watch this Python tutorial:

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...