How to build XGBoost on Windows - Now with GPU support

by Guido Tapia

in software-engineering,

September 22, 2016

  • Congratulations to the XGBoost team who have sorted out a lot of issues with XGBoost build on windows.

This is how I managed to build XGBoost on my environment:

  • Windows 10
  • Visual Studio 2015

Install CMake

CMake can be downloaded from here:

I downloaded the 64 bit zip file: and unzipped it to c:\dev\cmake-3.6.2-win64-x64.

[Edit - For GPU Support] Install CUDA and CUB

Download and install CUDA from here.

Download and unzip [CUB] (

Build XGBoost

To build XGBoost follow these steps:

  • git clone
  • cd xgboost
  • git submodule init
  • git submodule update
  • mkdir build
  • cd build
  • C:\dev\cmake-3.6.2-win64-x64\bin\cmake.exe .. -G”Visual Studio 14 2015 Win64”
    • Edit: For GPU support use command: C:\dev\cmake-3.6.2-win64-x64\bin\cmake.exe .. -G”Visual Studio 14 2015 Win64” -DPLUGIN_UPDATER_GPU=ON -DCUB_DIRECTORY=..\..\cub-1.6.4
  • C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe /t:Clean,Rebuild /p:Configuration=Release xgboost.sln


Your xgboost files are now in the xgboost\build\Release directory.


To configure the python wrapper follow these steps:

  • cp Release\libxgboost.dll ..\windows\x64\Release (create ..\windows\x64\Release if required)
  • cd ..\python-package
  • python install

Using the python wrapper

import xgboost
xr = xgboost.XGBRegressor(), y)