Skip to content

Manage dependencies

Nan Xiao edited this page Apr 29, 2024 · 8 revisions

Some features in stackgbm rely on certain R packages which may require specific system configurations to install from source. To make the build process robust, these dependencies have been configured as soft dependencies (Suggests) or runtime dependencies. Here are some instructions for installing such dependencies to enable the features in stackgbm.

Install xgboost

Install from CRAN:

install.packages("xgboost")

Install lightgbm

Install from CRAN:

install.packages("lightgbm")

Install catboost

To install the R package catboost or build from source, follow its official installation guide.

For example, to install the binary build for Mac computers with Apple silicon, use:

remotes::install_url(
  "https://github.com/catboost/catboost/releases/download/v1.2.5/catboost-R-darwin-universal2-1.2.5.tgz",
  INSTALL_opts = c("--no-multiarch", "--no-test-load", "--no-staged-install")
)

The package URL of the latest release can be retrieved from the catboost releases page.

Install RhpcBLASctl

lightgbm depends on an optional package RhpcBLASctl to detect the number of CPU cores. If it is not installed, you might see warning messages like this:

In .get_default_num_threads() :
  Optional package 'RhpcBLASctl' not found. Detection of CPU cores might not be accurate.

Install it from CRAN:

install.packages("RhpcBLASctl")

GPU support

Besides the standard CPU versions described above, you can also install and use the GPU-enabled builds of these packages. Please check out the official installation guides for detailed instructions. Using GPUs for training might require light customization of the stackgbm code to specify the correct hardware type.

Clone this wiki locally