Both FEniCSx and MFront are now available through the conda-forge channel:
An additional important package is dolfinx_materials.
Note: At the date of the last modification of this guide (16/07/2026), dolfinx_materials (v0.4.0) is designed for FEniCSx 0.10.x, while the default version available via conda-forge is already 0.11.0 (or later). Installing 0.11 will break dolfinx_materials with ImportError: cannot import name '_assign_block_data', so fenics-dolfinx must be pinned to 0.10. Note also that fenics-dolfinx is not compatible with Python 3.13+.
You can download the installer from the official Anaconda website or use the command below:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.shbash Miniconda3-latest-Linux-x86_64.shRestart your terminal, or activate Conda manually:
source ~/.bashrcconda create -n mfront python=3.12
conda activate mfrontconda install -c conda-forge jupyterlab pandas matplotlib scipy meshio pyvista openpyxl trame trame-vtk trame-vuetify ipywidgets gmsh tqdm python-gmshClone the repository now — its demos provide the .mfront files used to verify the MFront installation in the next step. The package itself will be installed later, once FEniCSx is available:
cd ~
git clone https://github.com/bleyerj/dolfinx_materials.gitconda install -c conda-forge mfront mgisThe conda-forge build of MFront ships with a build-time placeholder path baked in, which no longer exists after the package is relocated into your environment. As a result, mfront --obuild generates a Makefile.mfront pointing to a non-existent include/ directory and compilation fails with:
fatal error: TFEL/Raise.hxx: No such file or directory
You can check this by running:
tfel-config --includes
# -I/home/conda/feedstock_root/build_artifacts/bld/rattler-build_mfront_.../placehold_placehold.../includeMFront resolves its installation prefix from the TFELHOME environment variable first, so setting it to $CONDA_PREFIX fixes the issue:
export TFELHOME="$CONDA_PREFIX"
tfel-config --includes
# -I/home/<user>/anaconda3/envs/mfront/includeTo make this automatic, add an activation hook so that TFELHOME is set whenever the environment is activated and unset on deactivation. This keeps the variable scoped to this environment only and does not pollute ~/.bashrc or other environments:
mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" "$CONDA_PREFIX/etc/conda/deactivate.d"
cat > "$CONDA_PREFIX/etc/conda/activate.d/tfel.sh" << 'EOF'
export TFELHOME="$CONDA_PREFIX"
EOF
cat > "$CONDA_PREFIX/etc/conda/deactivate.d/tfel.sh" << 'EOF'
unset TFELHOME
EOFReactivate and verify:
conda deactivate
conda activate mfront
echo "$TFELHOME" # should print the path of your conda environmentCompile the StationaryHeatTransfer.mfront behaviour shipped with the dolfinx_materials demos:
cd ~/dolfinx_materials/demos/mfront/heat_transfer/
rm -rf include src
mfront --obuild --interface=generic StationaryHeatTransfer.mfrontRemoving the include/ and src/ directories beforehand is recommended, since MFront reuses previously generated files and a stale Makefile.mfront may still contain the wrong include paths.
The build succeeds if src/libBehaviour.so is generated. A warning about tangent operator blocks may appear; it is harmless here.
Pin the version to 0.10 for compatibility with dolfinx_materials (see the note at the top):
conda install -c conda-forge "fenics-dolfinx=0.10"This installs the whole FEniCS stack consistently (fenics-basix, fenics-ffcx, fenics-ufl, fenics-libdolfinx) without touching petsc4py, MPI or NumPy.
Now that FEniCSx is available, install the package cloned earlier:
cd ~/dolfinx_materials
pip install .Verify the installation:
python -c "from dolfinx_materials.solvers import NonlinearMaterialProblem; print('OK')"If this raises ImportError: cannot import name '_assign_block_data' from 'dolfinx.fem.petsc', your fenics-dolfinx is 0.11 or newer — downgrade it as described above.
This example (from the demos of dolfinx_materials) solves a nonlinear steady-state heat transfer problem using an MFront material behavior.
The behaviour library has already been compiled during the verification step above. If needed, rebuild it with:
cd ~/dolfinx_materials/demos/mfront/heat_transfer/
mfront --obuild --interface=generic StationaryHeatTransfer.mfrontThis generates the include/ and src/ directories.
cd ~/dolfinx_materials/demos/mfront/heat_transfer/
jupyter lab &The notebook nonlinear_heat_transfer.ipynb contains the full calculation setup.
Note: When defining the material, make sure to use the appropriate library extension: .so for Linux and .dylib for macOS.
material = MFrontMaterial(
os.path.join(current_path, "src/libBehaviour.so"), # Here
"StationaryHeatTransfer",
hypothesis="plane_strain",
)