Install and configure LightGBM gradient boosting framework with GPU/CPU support
Install and configure LightGBM, a high-performance gradient boosting framework that supports CPU, GPU, CUDA, and distributed training.
LightGBM is a gradient boosting framework that uses tree-based learning algorithms. This skill guides you through installation options ranging from simple PyPI installs to custom builds with GPU, CUDA, or MPI support.
Install the standard CPU/GPU-ready version:
```bash
pip install lightgbm
```
**Platform-specific requirements:**
Install with framework-specific extras:
```bash
pip install 'lightgbm[dask]'
pip install 'lightgbm[pandas]'
pip install 'lightgbm[scikit-learn]'
```
For custom configurations or unsupported platforms:
```bash
pip install --no-binary lightgbm lightgbm
```
**macOS users:** Choose Apple Clang (install OpenMP first) or gcc (set compilers: `export CXX=g++-14 CC=gcc-14`)
**Windows users:** Requires Visual Studio or VS Build Tools
Build with OpenCL GPU support:
```bash
pip install lightgbm \
--config-settings=cmake.define.USE_GPU=ON \
--config-settings=cmake.define.OpenCL_INCLUDE_DIR="/usr/local/cuda/include/" \
--config-settings=cmake.define.OpenCL_LIBRARY="/usr/local/cuda/lib64/libOpenCL.so"
```
**Requirements:**
Build with CUDA support for NVIDIA GPUs:
```bash
pip install lightgbm --config-settings=cmake.define.USE_CUDA=ON
```
**Usage:** Pass `{"device": "cuda"}` in parameters when training
Build with MPI for multi-node training:
```bash
pip install lightgbm --config-settings=cmake.define.USE_MPI=ON
```
**Requirements:** MPI libraries (OpenMPI, MPICH, or MS-MPI)
Install precompiled packages from conda-forge:
```bash
conda install -c conda-forge lightgbm
conda install -c conda-forge 'lightgbm>=4.4.0'
```
**Best for:** Systems without wheels (PowerPC), GPU users, conda environment management
Install bleeding-edge version:
```bash
git clone --recursive https://github.com/microsoft/LightGBM.git
cd LightGBM
sh ./build-python.sh install
```
Test your installation:
```python
import lightgbm as lgb
print(lgb.__version__)
try:
lgb.LGBMClassifier(device='gpu')
print("GPU support available")
except:
print("GPU support not available")
```
1. **32-bit Python**: Not supported. Use 64-bit Python.
2. **Missing OpenMP**: Install `libgomp1` (Linux), `libomp` (macOS), or VC runtime (Windows)
3. **GPU not detected**: Install OpenCL runtime or check drivers
4. **Windows compilation**: Use Visual Studio (better multithreading) over MinGW-w64
Available via `--config-settings=cmake.define.{option}`:
After installation, explore:
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/lightgbm-installation-and-usage/raw