QBoard » Artificial Intelligence & ML » AI and ML - Python » Trying to install xgboost in python on windows

Trying to install xgboost in python on windows

  • I have been driving myself crazy trying to install xgboost in python on windows 10. I have looked through several suggested articles but still can't seem to find a proper solution. If anyone has done this before kindly share your method other suggestions are also welcome.
      October 19, 2021 8:30 PM IST
    0
  • Step1.

    First, you need the Python 64-bit version. It is highly recommended to use the 64-bit Python version.

    Get the latest Python version

    https://www.python.org/downloads/windows/

    Get the Python 3.7 version(Latest version while writing this post)

    https://www.python.org/ftp/python/3.7.0/python-3.7.0-amd64.exe

    Install the downloaded python by clicking next and next.

    If you have python already installed, you can check the bit of the python by typing python in cmd.

    https://miro.medium.com/max/690/0*Q3r0JPlQwrj9qGVa.png 552w, https://miro.medium.com/max/800/0*Q3r0JPlQwrj9qGVa.png 640w, https://miro.medium.com/max/875/0*Q3r0JPlQwrj9qGVa.png 700w" alt="" width="700" height="294">

    In the above picture, if it shows 32 bit on your machine, then you must uninstall 32-bit python and install python 64-bit version.

    Step2.

    Install the pip, if you don’t have it on your machine.

    Get pip file using

    https://bootstrap.pypa.io/get-pip.py

    Save the above file and execute the file using

    python get-pip.py

    Now you have installed the pip.

    Step3.

    Get Python XGBoost whl file using below link

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost

    I have installed Python 3.7 64-bit version choose xgboost-0.81-cp37-cp37m-win_amd64.whl file.

    https://download.lfd.uci.edu/pythonlibs/r5uhg2lo/xgboost-0.81-cp37-cp37m-win_amd64.whl

    Make sure to match your python version and system architecture, e.g. “xgboost-0.81-cp37-cp37m-win_amd64.whl” for python 3.7 on 64-bitmachine

    Step4.

    Install the downloaded XGBoost Python whl file using below command.

    pip install xgboost-0.81-cp37-cp37m-win_amd64.whl

    That’s all. You have successfully installed XGBoost on your Windows 10.

    Step5.

    You can import the XGBoost package to test. Open any python editor and type below code

    import xgboost as xgb
      November 2, 2021 2:49 PM IST
    0
  • If You are installing XGBoost for a particular Project and You are using Pycahrm then you need to follow the procedures given below:
    1. Download xgboost‑0.72‑cp36‑cp36m‑win_amd64.whl from Here (as I am using Python 3.6 if you use different version of Python like 2.7 then you need to install xgboost‑0.72‑cp27‑cp27m‑win_amd64.whl).
    2. Copy the to your Project Interpreter directory. You can find the directory of Project Interpreter by clicking File -> Settings -> Project Interpreter from Pycharm.
    3. Open Command Prompt. Go to directory to you Project Interpreter from cmd. Write the following command: pip install xgboost-0.72-cp36-cp36m-win_amd64.whl
      October 20, 2021 3:31 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.
      October 22, 2021 2:24 PM IST
    0