XGBoosting Home | About | Contact | Examples

Install XGBoost for Python on Linux

Installing XGBoost on Linux is a straightforward process using pip, Python’s package installer.

To avoid potential conflicts with system-wide packages, it’s best to install XGBoost within a virtual environment.

This example provides the exact commands you need to get XGBoost up and running on your Linux machine.

First, create a new virtual environment for your project:

python3 -m venv myenv

Activate the virtual environment:

source myenv/bin/activate

Now, use pip to install XGBoost within your virtual environment:

pip install xgboost

The installation process should complete without any issues. You can verify that XGBoost is installed correctly by importing it in a Python script:

import xgboost as xgb

If the script runs without any errors, you have successfully installed XGBoost and are ready to start using it in your machine learning projects on Linux.

With XGBoost installed, you can now leverage its powerful capabilities to train and deploy gradient boosted decision tree models for a wide range of supervised learning tasks, including classification, regression, and ranking problems.

See Also