Install LightGBM with pip

Install LightGBM with pip#

2025-12-15

2 min read time

Applies to Linux

Prerequisites#

Before proceeding, ensure that you have installed a supported ROCm version, operating system, and Python version that are compatible with the ROCm Finance libraries. Verify that your system includes a supported AMD Instinct GPU. For guidance, see ROCm-Finance installation prerequisites.

For a consistent and streamlined setup experience, it’s recommended to use a ROCm development environment Docker container. See Install ROCm Finance for instructions.

Install using pip#

Install the ROCm-enabled LightGBM library from the AMD-hosted PyPI repository.

pip install amd_lightgbm --extra-index-url=https://pypi.amd.com/rocm-7.0.2/simple
pip install amd_lightgbm --extra-index-url=https://pypi.amd.com/rocm-6.4.4/simple

Verify your installation#

Use pip show to verify your installation:

pip show -v amd_lightgbm
Example output
Name: amd_lightgbm
Version: 4.6.0.99
Summary: ROCm Port of LightGBM Python-package
... [output truncated]

After installing LightGBM, import and use the library. For example:

import lightgbm as lgb
import numpy as np
rng = np.random.default_rng()
data = rng.uniform(size=(500, 10))  # 500 entities, each contains 10 features
label = rng.integers(low=0, high=2, size=(500, ))  # binary target
train_data = lgb.Dataset(data, label=label)