Open In App

How to Install Lightgbm on Windows?

In this article, we will learn how to install Lightgbm in Python on Windows .

LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed and efficient with the following advantages:



Installing Lightgbm on Windows :

Method 1: Using pip to install Lightgbm Package

Follow the below steps to install the Lightgbm package on Windows using pip:

Step 1: Install the latest Python3 in Windows



Step 2: Check if pip and python are correctly installed.

python --version
pip --version

Step 3: Upgrade your pip to avoid errors during installation.

pip install --upgrade pip

Step 4: Enter the following command to install Lightgbm using pip.

pip install lightgbm 

Method 2: Using setup.py to install Lightgbm 

Follow the below steps to install the Lightgbm on Windows using the setup.py file:

Step 1: Download the latest source package of Lightgbm for python3 from here.

curl https://files.pythonhosted.org/packages/fe/a2/cf319c151fe2cd863c57bca972c837ea5bf2aa01fd2313aa39ee478a46e5/lightgbm-3.3.0.tar.gz > lightgbm-3.3.0.tar.gz

Step 2: Extract the downloaded package using the following command.

tar -xzvf lightgbm-3.3.0.tar.gz

Step 3: Go inside the folder and Enter the following command to install the package.

cd lightgbm-3.3.0
python setup.py install

Verifying Lightgbm installation on Windows :

Make the following import in your python terminal to verify if the installation has been done properly:

import lightgbm 

If there is any error while importing the module then is not installed properly.

Article Tags :