Install Fastscapelib#

Choose the way to install Fastscapelib that best suits your needs. In general we recommend installing either the C++ or Python library using conda (or mamba).

C++ / _images/conda_logo.svg

Install the C++ (header-only) library with conda

(stable versions)

C++ / from source

Download and install the C++ (header-only) library with cmake

(stable & development versions)

Python / _images/conda_logo.svg & Pip

Install the pre-compiled Python library with conda or pip

(stable versions)

Python / from source

Download, build and install the Python library from source using Pip

(stable & development versions)

Download the Fastscapelib Source#

You can either download the last stable version as an archive here or you can clone the source repository using git (by default it will clone the active development main branch):

$ git clone https://github.com/fastscape-lem/fastscapelib

Install the C++ Library#

Fastscapelib C++ is header-only and requires a recent compiler that supports the C++17 standard. It also depends on:

  • xtensor (C++ array computing)

  • cmake (build and configuration)

See Section Build and Configuration for more details on how to include Fastscapelib in a (CMake) project.

Using Conda#

Fastscapelib conda packages are available for all stable versions via the conda-forge channel. You can install Fastscapelib’s C++ headers and all the dependencies using the following command (alternatively you can use mamba):

$ conda install fastscapelib -c conda-forge

From Source Using CMake#

In addition to a C++ compiler supporting C++17, you need xtensor and cmake that you can install, e.g., using conda:

$ conda install xtensor cmake -c conda-forge

After downloading the Fastscapelib source, run the commands below from the source root directory to install the fastscapelib’s header files using CMake:

$ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/prefix ..
$ cmake --build build
$ cmake --install build

Where /path/to/prefix is the path where the header files will be installed (skip this option if you want to install Fastscapelib in a default location).

See Section Build and Configuration for more information on the available build options.

Install the Python Library#

Fastscapelib’s Python package requires Python (3.9+) and numpy.

From Source Using Pip#

In addition to Python and Numpy, building and installing Fastscapelib-Python from source requires pip, pybind11, xtensor-python and scikit-build-core (a C++ compiler supporting C++17 is also required). All these dependencies are all available on conda-forge:

$ conda install python numpy pybind11 xtensor-python scikit-build-core pip -c conda-forge

After downloading the Fastscapelib source, you can build and install the Python package using pip. Run the following command from the source root directory:

$ python -m pip install . --no-build-isolation

The --no-build-isolation option is required since xtensor-python cannot yet be installed using pip. You can pass extra options like in the example below, which builds the Python extension in Debug mode in a given directory (useful for cached builds):

$ python -m pip install . \
$   --no-build-isolation \
$   --config-settings=cmake.build-type=Debug \
$   --config-settings=build-dir=build/skbuild

See scikit-build-core’s documentation for more available options.