Importing xgboost package in python




I’m new to python. I’m trying to import xgboost package in python 2, but not able to do it so far. Not able to find any good resources to get it done.

I’m using Windows 7, 64 bit machine with 6 GB RAM and i3 processor. Installed python 2.7 and Anaconda for python 2.7.

Are there any prerequisites to import xgboost ? Is there any step by step guide to import this ?

Please help !!



Hello Krishna,

Clone this repo and with your command prompt go to python folder of cloned folder then type
python install
this will do the job you wanted.


Hi Gruby,

Thanks for your inputs. I’ve tried that already facing some issue with that. Attached are the screenshots showing the same.

Am I missing something ?



Hi @krishna_cse37,

It’s really hard to get Xgboost installed on windows as general PIP doesn’t work. Even the above solution will not work. Read this Kaggle thread - the first post is your best bet.

I invested good 1-2 day to get it done. How I did it? Well I had binary version already made of XGboost package and I just made wrapper.dll file using Microsoft visual studio, following instruction on the mentioned Kaggle link. You need to build package using microsoft visual studio, which is a huge software with many addition dependencies(Took 2 - 3 GB of my internet pack).

Hope this helps.



Hi Krishna,

As pointed out by @aayushmnit it is difficult to compile dll on windows…you may refer the link provided by Aayush or below one to get working binary for windows.


Thanks @aayushmnit. I’ll try this and reply here.


Thanks gruby. I’ll try this and reply.