| 1 |
# Installation |
| 2 |
|
| 3 |
The main way to install `io4dolfinx` is through [PYPI](https://pypi.org/project/io4dolfinx/), which provides pre-built binary wheels for most platforms. This is the recommended method for most users. |
| 4 |
|
| 5 |
```bash |
| 6 |
python3 -m pip install io4dolfinx |
| 7 |
``` |
| 8 |
|
| 9 |
`io4dolfinx` has some optional dependencies for specific backends (like ADIOS2 or H5PY). If you want to use these backends, you can install the library with the appropriate extras: |
| 10 |
|
| 11 |
- Test dependencies (for running the test suite): |
| 12 |
|
| 13 |
```bash |
| 14 |
python3 -m pip install "io4dolfinx[test]" |
| 15 |
``` |
| 16 |
|
| 17 |
- Documentation dependencies (for building the docs): |
| 18 |
|
| 19 |
```bash |
| 20 |
python3 -m pip install "io4dolfinx[docs]" |
| 21 |
``` |
| 22 |
|
| 23 |
- For HDF5 support with MPI, you need to have an HDF5 library installed with MPI support, and the `h5py` Python package installed with MPI support. You can install `h5py` with MPI support using pip: |
| 24 |
|
| 25 |
```bash |
| 26 |
python3 -m pip install --no-binary=h5py h5py |
| 27 |
``` |
| 28 |
|
| 29 |
- For pyvista support, you can install the `pyvista` package: |
| 30 |
|
| 31 |
```bash |
| 32 |
python3 -m pip install pyvista |
| 33 |
``` |
| 34 |
|
| 35 |
or equivalently |
| 36 |
|
| 37 |
```bash |
| 38 |
python3 -m pip install "io4dolfinx[pyvista]" |
| 39 |
``` |
| 40 |
|
| 41 |
- For ADIOS2 support you should have ADIOS2 installed with Python bindings, see https://adios2.readthedocs.io/en/latest/setting_up/setting_up.html for more info. |
| 42 |
|
| 43 |
## Spack |
| 44 |
|
| 45 |
The FEniCS Spack packages uses a separate [spack repo](https://github.com/FEniCS/spack-fenics) to be possible to maintain and keep up to date. |
| 46 |
We do the same for the [packages](https://github.com/scientificcomputing/spack_repos.git) maintained by Scientific Computing at Simula Research Laboratory. |
| 47 |
To install `py-io4dolfinx`, one should first install spack on your system, then use the following commands in a new spack environment: |
| 48 |
|
| 49 |
```bash |
| 50 |
spack repo add https://github.com/FEniCS/spack-fenics.git |
| 51 |
spack repo add https://github.com/scientificcomputing/spack_repos.git |
| 52 |
spack add [email protected] ^py-fenics-dolfinx+petsc4py ^adios2+python+hdf5 ^petsc+mumps |
| 53 |
``` |
| 54 |
|
| 55 |
to get an installation of `io4dolfinx` with all backends installed. If you require further petsc packages you should activate them by adding them to `^petsc+....`. |
| 56 |
See [Spack PETSc](https://packages.spack.io/package.html?name=petsc) for options. |
| 57 |
|
| 58 |
## Docker |
| 59 |
|
| 60 |
An MPI build of ADIOS2 is installed in the official DOLFINx containers, and thus there are no additional dependencies required to install `io4dolfinx` |
| 61 |
on top of DOLFINx in these images. |
| 62 |
|
| 63 |
Create a Docker container, named for instance `dolfinx-checkpoint`. |
| 64 |
Use the `nightly` tag to get the main branch of DOLFINx, or `stable` to get the latest stable release |
| 65 |
|
| 66 |
```bash |
| 67 |
docker run -ti -v $(pwd):/root/shared -w /root/shared --name=dolfinx-checkpoint ghcr.io/fenics/dolfinx/dolfinx:nightly |
| 68 |
``` |
| 69 |
|
| 70 |
For the latest version compatible with nightly (with the ability to run the test suite), use |
| 71 |
|
| 72 |
```bash |
| 73 |
export HDF5_MPI=ON |
| 74 |
export HDF5_DIR=/usr/local |
| 75 |
python3 -m pip install --no-binary-h5py --no-build-isolation io4dolfinx[test]@git+https://github.com/scientificcomputing/io4dolfinx@main |
| 76 |
``` |
| 77 |
|
| 78 |
If you are using the `stable` image, you can install `io4dolfinx` from [PYPI](https://pypi.org/project/io4dolfinx/) with |
| 79 |
|
| 80 |
```bash |
| 81 |
python3 -m pip install io4dolfinx[test] |
| 82 |
``` |
| 83 |
|
| 84 |
This docker container can be opened with |
| 85 |
|
| 86 |
```bash |
| 87 |
docker container start -i dolfinx-checkpoint |
| 88 |
``` |
| 89 |
|
| 90 |
at a later instance |
| 91 |
|
| 92 |
## Conda |
| 93 |
|
| 94 |
```{note} |
| 95 |
Conda supports the stable release of DOLFINx, and thus the appropriate version should be installed, see the section above for more details. |
| 96 |
``` |
| 97 |
|
| 98 |
Following is a minimal recipe of how to install io4dolfinx, given that you have conda installed on your system. |
| 99 |
|
| 100 |
```bash |
| 101 |
conda create -n dolfinx-checkpoint python=3.12 |
| 102 |
conda activate dolfinx-checkpoint |
| 103 |
conda install -c conda-forge io4dolfinx |
| 104 |
``` |
| 105 |
|
| 106 |
```{note} |
| 107 |
Remember to download the appropriate version of `io4dolfinx` from Github [io4dolfinx: Releases](https://github.com/scientificcomputing/io4dolfinx/releases) |
| 108 |
``` |
| 109 |
|
| 110 |
To run the test suite, you should also install `ipyparallel`, `pytest` and `coverage`, which can all be installed with conda |
| 111 |
|
| 112 |
```bash |
| 113 |
conda install -c conda-forge ipyparallel pytest coverage |
| 114 |
``` |