Last modified: Jun 01, 2025 By Alexander Williams
Install CatBoost in Python Easily
CatBoost is a powerful gradient-boosting library for machine learning. It works well with categorical data. This guide will help you install it quickly.
Prerequisites for Installing CatBoost
Before installing CatBoost, ensure you have Python 3.5 or higher. You also need pip, Python's package installer.
Check your Python version using:
import sys
print(sys.version)
3.9.7 (default, Sep 16 2021, 16:59:28)
[GCC 10.3.0]
Install CatBoost Using pip
The easiest way to install CatBoost is via pip. Run this command in your terminal:
pip install catboost
This will download and install the latest stable version. For GPU support, use pip install catboost-gpu
instead.
Verify the Installation
After installation, verify it works by importing CatBoost in Python:
from catboost import CatBoostClassifier
print("CatBoost installed successfully!")
CatBoost installed successfully!
Install CatBoost with Conda
If you use Anaconda, install CatBoost via conda-forge:
conda install -c conda-forge catboost
This method is useful if you manage packages with Conda. For other Python libraries, see our guide on installing LightGBM.
Basic CatBoost Example
Here's a simple example to test your CatBoost installation:
from catboost import CatBoostClassifier
from sklearn.datasets import load_iris
# Load data
data = load_iris()
X, y = data.data, data.target
# Train model
model = CatBoostClassifier(iterations=10)
model.fit(X, y)
# Predict
print(model.predict([[5.1, 3.5, 1.4, 0.2]]))
[0]
Troubleshooting Installation Issues
If installation fails, try upgrading pip first:
pip install --upgrade pip
For permission errors, add --user
flag. For other Python package issues, check our PyMC3 installation guide.
Conclusion
Installing CatBoost in Python is simple with pip or conda. Verify the installation works before using it for machine learning tasks. For optimization tasks, see our PySCIPOpt guide.
CatBoost offers excellent performance for categorical data. Start with small examples before scaling to larger datasets.