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).
Download and install the C++ (header-only) library with cmake
(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:
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.
Pre-compiled packages (recommended)#
Conda#
All stable versions of Fastscapelib-Python are available as pre-compiled binary conda packages for Linux, MacOS and Windows via the conda-forge channel. You can install it using the following command (alternatively you can use mamba):
$ conda install fastscapelib-python -c conda-forge
Pip#
All stable versions of Fastscapelib-Python are also available on https://pypi.org/ as binary wheels for Linux, MacOS and Windows. You can install it using pip:
$ python -m pip install fastscapelib
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.