I try to compile DOLFINx v0.9.0 from source on docker of Ubuntu-20.04. The reason for this is because I made some modification on the source code and the public machines (server and HPC) use relatively old kernel. So I need to mimic a similar environment do installation, e.g. glibc with 2.31.
I followed the instruction dolfinx/docker/Dockerfile.test-env at main · FEniCS/dolfinx · GitHub to build up a test environment and made some adaption on Ubuntu-20.04. Then I try it with the official demo Poisson equation — DOLFINx 0.9.0 documentation with
python demo_poisson.py
yielding
Traceback (most recent call last):
File "demo_poisson.py", line 107, in <module>
V = fem.functionspace(msh, ("Lagrange", 1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dolfinx-env/lib/python3.12/site-packages/dolfinx/fem/function.py", line 628, in functionspace
cpp_element = _create_dolfinx_element(mesh.comm, mesh.topology.cell_type, ufl_e, dtype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dolfinx-env/lib/python3.12/site-packages/dolfinx/fem/function.py", line 586, in _create_dolfinx_element
return CppElement(basix_e, ufl_e.block_size, ufl_e.is_symmetric)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible function arguments. The following argument types are supported:
1. __init__(self, element: basix::FiniteElement<float>, block_size: int, symmetric: bool) -> None
2. __init__(self, elements: collections.abc.Sequence[dolfinx.cpp.fem.FiniteElement_float32]) -> None
3. __init__(self, cell_type: dolfinx.cpp.mesh.CellType, points: numpy.ndarray[dtype=float32, shape=(*, *)], block_size: int, symmetry: bool) -> None
Invoked with types: dolfinx.cpp.fem.FiniteElement_float32, basix._basixcpp.FiniteElement_float32, int, bool
I sense that the problem is due to the mismatching of data type version of dependencies, but no idea how to correct it.
Other helpful-maybe info:
python3 -c "import dolfinx; import petsc4py; petsc4py.init(); print(petsc4py.PETSc)"
yielding
<module 'petsc4py.PETSc' from '/dolfinx-env/lib/python3.12/site-packages/petsc4py/lib/linux-gnu-real32-32/PETSc.cpython-312-x86_64-linux-gnu.so'>
For ffcx
, basix
and ufl
, I installed via pip
:
pip install fenics-basix==0.9.0
pip install fenics-ffcx==0.9.0