QBoard » Advanced Visualizations » Viz - Python » How can I install XGBoost package in python on Windows

How can I install XGBoost package in python on Windows

  • I tried to install XGBoost package in python. I am using windows os, 64bits . I have gone through following.

    The package directory states that xgboost is unstable for windows and is disabled: pip installation on windows is currently disabled for further invesigation, please install from github. https://pypi.python.org/pypi/xgboost/

    I am not well versed in Visual Studio, facing problem building XGBoost. I am missing opportunities to utilize xgboost package in data science.

    Please guide, so that I can import the XGBoost package in python.

    Thanks

      December 8, 2021 10:31 AM IST
    0
  • Note that as of the most recent release the Microsoft Visual Studio instructions no longer seem to apply as this link returns a 404 error:

    https://github.com/dmlc/xgboost/tree/master/windows

    You can read more about the removal of the MSVC build from Tianqi Chen's comment here.

    So here's what I did to finish a 64-bit build on Windows:

    1. Download and install MinGW-64: http://sourceforge.net/projects/mingw-w64/
    2. On the first screen of the install prompt make sure you set the Architecture to x86_64 and the Threads to win32
    3. I installed to C:\mingw64 (to avoid spaces in the file path) so I added this to my PATH environment variable: C:\mingw64\mingw64\bin
    4. I also noticed that the make utility that is included in bin\mingw64 is called mingw32-make so to simplify things I just renamed this to make
    5. Open a Windows command prompt and type gcc. You should see something like "fatal error: no input file"
    6. Next type make. You should see something like "No targets specified and no makefile found"
    7. Type git. If you don't have git, install it and add it to your PATH.

    These should be all the tools you need to build the xgboost project. To get the source code run these lines:

    1. cd c:\
    2. git clone --recursive https://github.com/dmlc/xgboost
    3. cd xgboost
    4. git submodule init
    5. git submodule update
    6. cp make/mingw64.mk config.mk
    7. make -j4

    Note that I ran this part from a Cygwin shell. If you are using the Windows command prompt you should be able to change cp to copy and arrive at the same result. However, if the build fails on you for any reason I would recommend trying again using cygwin.

    If the build finishes successfully, you should have a file called xgboost.exe located in the project root. To install the Python package, do the following:

    1. cd python-package
    2. python setup.py install

    Now you should be good to go. Open up Python, and you can import the package with:

    import xgboost as xgb
    

     

    To test the installation, I went ahead and ran the basic_walkthrough.py file that was included in the demo/guide-python folder of the project and didn't get any errors.

     
      December 27, 2021 12:11 PM IST
    0
    1. download xgboost whl file from here (make sure to match your python version and system architecture, e.g. "xgboost-0.6-cp35-cp35m-win_amd64. whl" for python 3.5 on 64-bit machine)
    2. open command prompt.
    3. cd to your Downloads folder (or wherever you saved the whl file)
    4. pip install xgboost-0.6-cp35-cp35m-win_amd64.
      December 15, 2021 12:33 PM IST
    0
  • Install XGBoost on Windows 10 For Python Programming in Easy...
    1. Step1. First, you need the Python 64-bit version. ...
    2. Step2. Install the pip, if you don't have it on your machine.
    3. Step3. Get Python XGBoost whl file using below link.
    4. Step4. Install the downloaded XGBoost Python whl file using below command. ...
    5. Step5.
      December 17, 2021 11:45 AM IST
    0