What are the dependencies and build requirements for mlpack?

Updated

mlpack is a header-only C++ machine learning library, so you do not compile mlpack itself as a separate library. Instead, you need a C++ compiler plus the libraries it builds on: Armadillo, ensmallen, and cereal. Because it is header-only, including the mlpack headers in your project is enough to use the library, provided those dependencies are available. The exact minimum versions are maintained in the documentation rather than on the home page, so check the docs for the version that matches your mlpack release.

Core dependencies

Dependency Role
Armadillo Linear algebra and matrix operations
ensmallen Numerical optimization (used by many mlpack algorithms)
cereal Serialization (saving/loading models and data)

mlpack is written in C++ and built on these three libraries. If any of them is missing or too old, compilation of code that includes mlpack headers will fail.

What "header-only" means for your build

  • There is no separate mlpack library binary to link against for the core C++ library.
  • You add the mlpack include directory to your compiler's include path and #include the headers you need.
  • Your compiler still needs to find Armadillo, ensmallen, and cereal headers, and you may need to link the underlying numerical libraries that Armadillo depends on (for example, a BLAS/LAPACK implementation), depending on your Armadillo configuration.

Bindings and other languages

mlpack also provides bindings to Python, Julia, R, Go, and the command-line. If you use a binding rather than writing C++ directly, the build requirements differ: you build or install the binding, which in turn depends on the C++ library and its dependencies. The home page lists these bindings but does not give per-binding build instructions, so consult the documentation for the binding you intend to use.

Practical build checklist

  1. Install a C++ compiler that supports the C++ standard required by your mlpack version.
  2. Install Armadillo, ensmallen, and cereal, meeting the minimum versions stated in the mlpack documentation for your release.
  3. Make sure your build system can find those headers (include paths) and any libraries Armadillo needs.
  4. Add the mlpack headers to your include path and compile your program.
  5. If compilation fails, verify dependency versions first — version mismatches are the most common cause.

Version and licensing notes

  • The latest version shown on the site is 4.8.0 (9.9 MB, released June 9, 2026).
  • mlpack is open source under the permissive 3-clause BSD license.
  • It uses an open governance model and is fiscally sponsored by NumFOCUS.

For the authoritative, version-specific dependency requirements, use the Documentation and Download links on mlpack.org rather than relying on the home page summary.