Install XGBoost with pip

Install XGBoost with pip#

2026-07-17

1 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 AMD Finance libraries. Verify that your system includes an AMD GPU fully supported by ROCm Finance. For guidance, see AMD Finance installation prerequisites.

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

Install using pip#

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

pip install amd_xgboost --extra-index-url=https://pypi.amd.com/rocm-7.1.1/simple
pip install amd_xgboost --extra-index-url=https://pypi.amd.com/rocm-7.0.2/simple
pip install amd_xgboost --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_xgboost
Example output
Name: amd_xgboost
Version: 3.1.1
Summary: XGBoost Python Package
... [output truncated]

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

import xgboost as xgb
import numpy as np
data = np.random.rand(5, 10)  # 5 entities, each contains 10 features
label = np.random.randint(2, size=5)  # binary target
dtrain = xgb.DMatrix(data, label=label)