How to install xgboost in python?



If you are using ANACONDA, please check below link for instructions

Shell Command:

conda install -c xgboost

If you want to do it on your own, here comes a short guide to compile and install xgboost from source on win64:

1) Download & install Git for win64:

2) Download & install mingw-w64:

3) Let’s assume we have the following installation paths: C:\mingw64 and C:\Program Files\git => Add the following paths to your windows environment PATH: C:\mingw64\bin and c:\programs\Git\cmd

4) Start cmd.exe and check if you can run git and gcc from command line

  • type gcc, you should get: “gcc: fatal error: no input files”
  • type make, you should get: “make: * No targets specified and no makefile found. Stop.”
  • type git, you should get … u get it

5) Let’s create C:\mypy. Open an command prompt an cd to this folder. Type git clone

6) cd to c:\mypy\xgboost and type make. Xgboost should compile now. Afterwards type list | grep xgb and it should list “xgboost.exe”

7) cd to c:\mypy\xgboost\python-package and type python install

8) do not build better xgboost models then I do 😛

Complete thread –

Thank you Faron, for your quick/supportive help.


Note: Since the time this post has been written, there were many updates to Xgbo0st and Anaconda. I would request to kindly use Anaconda – Python Setup with Packages or Miniconda(a simpler version of Anaconda) for installing Xgbo0st.