Installation#
DOLFINx can be installed using various packages managers, run using containers, or built manually from source.
Binaries#
See the README.md for recommendations and instructions.
Source#
Installation of DOLFINx requires installation of the C++ core. Most users will also want the Python interface.
Dependencies#
C++#
Required
C++ compiler (supporting the C++20 standard)
Basix (C++ interface)
CMake [build dependency]
HDF5 (with MPI support enabled)
MPI (MPI-3 or later)
pkg-config [build dependency via CMake]
UFCx [
ufcx.h, provided by FFCx Python package or FFCx UFCx CMake install atffcx/cmake/*]
From ParMETIS, KaHIP or PT-SCOTCH, ParMETIS is recommended.
Optional
ADIOS2 (additional parallel IO support)
SLEPc (eigenvalue problems)
SuperLU_DIST [2] (linear problems with
dolfinx::la::MatrixCSR).
Optional for demos
FFCx
PETSc and FFCx are optional but recommended.
Python interface#
Requirements for the Python interface. Please see python/pyproject.toml for
precise specification. Below we use the pypi package names.
Build system requirements
Python
DOLFINx C++ interface and all requirements
nanobind (static linking)
petsc4py (recommended, optional)
Required runtime dependencies
Optional runtime dependencies
petsc4py (linear and non-linear problems, recommended)
numba (custom kernels and assemblers)
pyamg + scipy (serial linear problems)
Optional for demos
gmsh
networkx
numba
matplotlib
petsc4py
pyamg
pyvista
scipy
slepc4py
Building and installing#
C++#
The C++ library is built using CMake. Create a build directory in
cpp/, e.g. mkdir -p build/ and in the build run directory:
cmake ../
make install
To set the installation prefix:
cmake -DCMAKE_INSTALL_PREFIX=<my-install-path> ../
make install
PETSc and SLEPc installed as a Python package
PETSc and SLEPc are located with pkg-config. If PETSC_DIR
(SLEPC_DIR) is not set in the environment, the Python interpreter is
asked for the prefix of an importable petsc (slepc) package,
however it was installed. PETSc 3.25.5 or later is required, as earlier
versions did not ship pkg-config files in the Python package tree.
For example, with pip:
PETSC_CONFIGURE_OPTIONS="--download-parmetis --download-metis" \
pip install petsc petsc4py
cmake ../
make install
PETSc installs the required graph partitioner into the same prefix, where it is picked up alongside PETSc itself.
Python#
After installation of the C++ interface, from the python/ directory
the Python interface can be installed using:
pip install --group pyproject.toml:build
pip install --check-build-dependencies --no-build-isolation .
Footnotes