# 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)

- Boost

- CMake [build dependency]

- HDF5 (with MPI support enabled)

- MPI (MPI-3 or later).

- pkg-config

- pugixml

- spdlog

- UFCx [`ufcx.h`, provided by FFCx package or FFCx UFCx CMake install at `ffcx/cmake/*`]

- At least one of ParMETIS [2], KaHIP or PT-SCOTCH [2]

From ParMETIS, KaHIP or PT-SCOTCH, ParMETIS is recommended.

Optional

- ADIOS2 (additional parallel IO support)

- PETSc [1]

- SLEPc (eigenvalue computations)

Optional for demos

- FFCx

PETSc and FFCx are optional but recommended.

#### Python interface

Requirements for the Python interface, in addition to the C++ requirements.

Required

- Python

- Python CFFI (https://cffi.readthedocs.io/)

- FFCx, UFL and Basix Python interface.

- mpi4py (https://mpi4py.readthedocs.io/)

- nanobind (https://github.com/wjakob/nanobind)

- NumPy (https://www.numpy.org)

- scikit-build-core[pyproject] (https://scikit-build-core.readthedocs.io)

Optional

- petsc4py (recommended)

Optional for demos

- Numba

- pyamg

- pyvista (for plotting)

- 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

#### Python

After installation of the C++ interface, from the `python/` directory the Python interface can be installed using:

    pip install -r build-requirements.txt
    pip install --check-build-dependencies --no-build-isolation .

Footnotes

[1]

Its is recommended to configure with ParMETIS, PT-SCOTCH, MUMPS and Hypre using `--download-parmetis --download-ptscotch --download-suitesparse --download-mumps --download-hypre`. macOS users should additionally configure MUMPS via PETSc with `--download-mumps-avoid-mpi-in-place`.

[2] (1,2)

PETSc can download and configure and build these libraries.