Installing XGBoost


xgboost is a very popular machine learning library and widely used (for example on kaggle). However, contrary to a lot of other popular libraries it can not be easily installed with conda or pip. You have to compile the library first. The installation guide can be found here. This blog post is a short version of the installation guide and mainly targeted for myself for reference.

Installation on Windows

  • Clone the recent git:
  • Download the current library here
  • cd into the folder %path to xgboost git%/python-package
  • activate the correct conda environment (in my case activate ml)
  • execute python install
  • Test the installation by entering python
    • enter import xgboost

Installation on OSX

  • Clone the recent git:
    • use git clone --recursive
  • Install the OSX Developer Command line tools
    • xcode-select --install
  • Navigate to the git repository
    • usually by calling cd xgboost
  • Enter the following commands in the terminal
    • cp make/ ./
    • make -j4
  • Navigate into the python-package folder
  • activate the correct conda environment (in my case source activate ml)
  • call sudo python install
  • test the installation by entering python
    • enter import xgboost