Skip to content
Related Articles
Open in App
Not now

Related Articles

How to Install Lightgbm on Windows?

Improve Article
Save Article
  • Last Updated : 26 Oct, 2021
Improve Article
Save Article

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:

  • Faster training speed and higher efficiency.
  • Lower memory usage.
  • Better accuracy.
  • Support of parallel, distributed, and GPU learning.
  • Capable of handling large-scale data.

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

checking python and pip version in Windows

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

pip install --upgrade pip

upgrading pip in Windows

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

pip install lightgbm 

installing Lightgbm package on Windows using pip

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

downloading the source package for Lightgbm in Windows

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

tar -xzvf lightgbm-3.3.0.tar.gz

extracting the lightgbm-3.3.0.tar.gz file in Windows

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

cd lightgbm-3.3.0
python setup.py install

installing Lightgbm on Windows using the setup.py file

Verifying Lightgbm installation on Windows :

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

import lightgbm 

Verifying Lightgbm installation on Windows

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

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!