I Knew You Were TROUBLE (Xgboost + Python + Windows) : A Proper Guide

So yeah, Xgboost + Python + Windows is an invitation to a trouble. That is if you don’t do the build and installation properly!

So let’s get everything unwrapped CORRECTLY! First, I am using following versions.
xgboost: 0.4
python: 3.5.0
Windows 8: 64-bit
Microsoft Visual Studio C++: 2013

1. First, clone xgboost with submodules
git clone <repo_url> --recursive

2. Revert to the correct release (0.4)
git checkout <commit_id>

3. Open MSVS (Visual Studio), and the project. It should be located at

4. Now your “Solution Explorer” should look like this
MSVS Solution Explorer

5. Set the properties. Open “Project Properties” from the main menu (Project -> Properties). Then from that, open “Configuration Manager”. Then set all the projects to “Release” and “x64” as in the image.
Configuration Manager

6. Now you’re ready to go. Cross your fingers and choose “Build Solution” from the build menu. If everything goes well, you should be able to see something like in this log file in the output console

7. Go to <repo_root>\windows\. Inside, there should be a folder x64\Release. You will find all the built files in there. Namely, they should be,

  • rabit.lib
  • xgboost.exe
  • xgboost.pdb
  • xgboost_wrapper.dll
  • xgboost_wrapper.exp
  • xgboost_wrappe.libr
  • xgboost_wrapper.pdb

8. Copy all of this to <repo_root>\wrapper\ (If this doesn’t exist, check if <repo_root>\python-packages\xgboost exists)

9. Run python setup.py install

10. This should be it. You might have to add xgboost to the project depending on your IDE. To make sure everything went well, check if <anaconda_root>\lib\site-packages\xgboost exists (if using Anaconda).

Potential issues:
[Error 193] %1 is not a valid Win32 app
If you’re getting this error, you probably used “Win32” for platform. Try it with “x64”

unimplemented: 64-bit mode not compiled in
Using make tools such as Cygwin64 didn’t work form me. I kept getting the above error

Several resources that helped me
[1] https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python
[2] http://xgboost.readthedocs.org/en/latest/build.html

  • Aj

    Thanks, this was very helpful. If you get the .4x update working on windows I’d love to see that also.. 0.4x kept failing on me so i went back to .4 and it worked fine.

    • admin

      Thanks for the feedback. Yeah, I had some trouble with version .4x But I’ll give it a go again

  • bhuv

    Can we just share the wrapper files. Why does everyone need to make their own wrapper files?

  • Max Kohl

    Thanks so much for this!

    Just 2 things:
    – At point 9, make sure you cd into \python-packages.
    – For win32 settings, just mark Win32 at point 5