XGBoost provides binary packages for some language bindings. The binary packages support
the GPU algorithm (device=cuda:0) on machines with NVIDIA GPUs. Please note that
training with multiple GPUs is only supported for Linux platform. See
XGBoost GPU Support. Also we have both stable releases and nightly builds, see below for how
to install them. For building from source, visit this page.
Stable Release
Python
Pre-built binary wheels are uploaded to PyPI (Python Package Index) for each release. Supported platforms are Linux (x86_64, aarch64), Windows (x86_64) and MacOS (x86_64, Apple Silicon).
# Pip 21.3+ is required
pipinstallxgboost
You might need to run the command with --user flag or use if you run
into permission errors.
virtualenv
Capabilities of binary wheels for each platform:
Platform
GPU
Multi-Node-Multi-GPU
Linux x86_64
✔
✔
Linux aarch64
✔
✘
MacOS x86_64
✘
✘
MacOS Apple Silicon
✘
✘
Windows
✔
✘
Linux aarch64 wheels now ship with CUDA support, so pipinstallxgboost on
modern Jetson or Graviton machines provides the same GPU functionality as the
Linux x86_64 wheel. Multi-node and multi-GPU training remain experimental on
ARM64 at this time.
Minimal installation (CPU-only)
The default installation with pip will install the full XGBoost package, including the support for the GPU algorithms and federated learning.
You may choose to reduce the size of the installed package and save the disk space, by opting to install xgboost-cpu instead:
pip install xgboost-cpu
The xgboost-cpu variant will have drastically smaller disk footprint, but does not provide some features, such as the GPU algorithms and
federated learning.
Currently, xgboost-cpu package is provided for x86_64 (amd64) Linux and Windows platforms.
Conda
You may use the Conda packaging manager to install XGBoost:
conda install -c conda-forge py-xgboost
Conda should be able to detect the existence of a GPU on your machine and install the correct variant of XGBoost. If you run into issues, try indicating the variant explicitly:
# CPU variant
condainstall-cconda-forgepy-xgboost=*=cpu*
# GPU variant
condainstall-cconda-forgepy-xgboost=*=cuda*
To force the installation of the GPU variant on a machine that does not have an NVIDIA GPU, use environment variable CONDA_OVERRIDE_CUDA,
as described in “Managing Virtual Packages” in the conda docs.
We also provide experimental pre-built binary with GPU support. With this binary,
you will be able to use the GPU algorithm without building XGBoost from the source.
Download the binary package from the Releases page. The file name will be of the form
xgboost_r_gpu_[os]_[version].tar.gz, where [os] is either linux or win64.
(We build the binaries for 64-bit Linux and Windows.)
Then install XGBoost by running:
<properties>...
<!-- Specify Scala version in package name --><scala.binary.version>2.12</scala.binary.version></properties><dependencies>...
<dependency><groupId>ml.dmlc</groupId><artifactId>xgboost4j-spark_${scala.binary.version}</artifactId><version>latest_version_num</version></dependency></dependencies>
<properties>...
<!-- Specify Scala version in package name --><scala.binary.version>2.12</scala.binary.version></properties><dependencies>...
<dependency><groupId>ml.dmlc</groupId><artifactId>xgboost4j-spark-gpu_${scala.binary.version}</artifactId><version>latest_version_num</version></dependency></dependencies>
This will check out the latest stable version from the Maven Central.
For the latest release version number, please check release page.
To enable the GPU algorithm (device='cuda'), use artifacts xgboost4j-spark-gpu_2.12 instead (note the gpu suffix).
Nightly Build
Python
Nightly builds are available. You can go to this page,
find the wheel with the commit ID you want and install it with pip:
pip install <url to the wheel>
The capability of Python pre-built wheel is the same as stable release.
R
Other than standard CRAN installation, we also provide experimental pre-built binary on
with GPU support. You can go to this page, Find the commit
ID you want to install and then locate the file xgboost_r_gpu_[os]_[commit].tar.gz,
where [os] is either linux or win64. (We build the binaries for 64-bit Linux
and Windows.) Download it and run the following commands:
<properties>...
<!-- Specify Scala version in package name --><scala.binary.version>2.12</scala.binary.version></properties><dependencies><dependency><groupId>ml.dmlc</groupId><artifactId>xgboost4j-spark_${scala.binary.version}</artifactId><version>latest_version_num-SNAPSHOT</version></dependency></dependencies>
<properties>...
<!-- Specify Scala version in package name --><scala.binary.version>2.12</scala.binary.version></properties><dependencies><dependency><groupId>ml.dmlc</groupId><artifactId>xgboost4j-spark-gpu_${scala.binary.version}</artifactId><version>latest_version_num-SNAPSHOT</version></dependency></dependencies>
Look up the version field in pom.xml to get the correct version number.
The SNAPSHOT JARs are hosted by the XGBoost project. Every commit in the master branch will automatically trigger generation of a new SNAPSHOT JAR. You can control how often Maven should upgrade your SNAPSHOT installation by specifying updatePolicy. See here for details.