How to install XGBoost on windows

Recently my mac book ran out of service while I was at the middle of learning “Machine Learning”. For emergency purpose I had to buy a low configured windows machine with Windows 10 (32 bit) pre-installed. I thought why shouldn’t I try learning ML on this computer and see it’s limit. I was able to run most of the ML algorithms from logistic regresion, classification, and even NLP (National Language Processing). At the very end of my learning, I faced problem to install XGBoost on windows. However, finally I was able to manually install it and run my script successfully. Today I’ll show you how did I overcome this problem in 3 steps.

Step 1 – Gather information
  1. Python Version: Open command prompt and run following command to get version of python that installed on your system

    > python –version

  2.  System Architecture: Go to desktop and right click on “My computer or This PC” icon. From context menu select properties. System window will appear with all the information related to your system. Note down whether the operating system is 32 bit or 64 bit.
Step 2: Download windows binary file for XGBoost


Many libraries are listed in this page. Find and search for XGboost section. In XGBoost section, you will see a list of binary files. Download the one that best matches your system architecture (64 bit or 32 bit) and python version. For example, xgboost‑0.72‑cp37‑cp37m‑win32.whl

binary package is suitable for python version 3.7 and windows 32 bit operating system. Here, cp37 indicates the python version 3.7 and win32 stands for windows 32 bit architecture.

Step 3: Install XGBoost on windows

Finally, it is time to install XGBoost on windows system.

1. Open command prompt in Administrator mode (Find Command Prompt in your menu, right click on the menu and click Run as Administrator)

2. cd to the folder where you downloaded XGBoost binary file

2. Run the following command:

> pip install xgboost‑0.72‑cp37‑cp37m‑win32.whl

If the installation fails due to any missing dependency, install them and re-run the pip install command.

Now, check whether XGBoost installed on your computer by using following command:


import xgboost

If XGBoost is not installed properly, then you will see an error message.


Leave a Reply