Can't create the function space in dolfinx0.8.0

I update my fenicsx from 0.7.0 to 0.8.0. I learned that:

  • Replace all ufl.FiniteElement and ufl.VectorElement with the appropriate basix.ufl.element
  • Replace dolfinx.fem.FunctionSpace with dolfinx.fem.functionspace
    So I use the following codes to create a vector functionspace.
import dolfinx
import basix
from mpi4py import MPI

mesh = dolfinx.mesh.create_box(comm=MPI.COMM_WORLD, points=[[0, 0, 0], [1, 1, 1]], n=[2, 2, 2],
element = basix.ufl.element(family="Lagrange", cell=mesh.topology.cell_name(),
                degree=1, shape=(mesh.topology.dim,))
fs = dolfinx.fem.functionspace(mesh, element)

But output the errors.

Traceback (most recent call last):
  File "/mnt/d/BaiduNetdiskWorkspace/MultiscaleDynamicTOP/code/FEniCSBasedProject/Test/", line 25, in <module>
    fs = dolfinx.fem.functionspace(mesh, element)
  File "/usr/lib/petscdir/petsc3.19/x86_64-linux-gnu-real/lib/python3/dist-packages/dolfinx/fem/", line 668, in functionspace
    cpp_element = _cpp.fem.FiniteElement_float64(
RuntimeError: Invalid celltype in Nedelec

Process finished with exit code 1


which Version of dolfinx are you using?

I am using:

DOLFINx version: 0.8.0 based on GIT commit: 5a20e2ba3907c1f108cb0af45931f46e32250351 of

and when I run your code, I did not receive an error message.
If I access fs it gives me:


FunctionSpace(Mesh(blocked element (Basix element (P, hexahedron, 1, gll_warped, unset, False, float64, []), (3,)), 3), blocked element (Basix element (P, hexahedron, 1, gll_warped, unset, False, float64, []), (3,)))

Best regards

The paths /usr/lib/petscdir/petsc3.19/x86_64-linux-gnu-real/lib/python3/dist-packages/dolfinx/fem/ seem to be for a ubuntu/debian system.

I would probably guess that @lyunfei1211 has at least a local installation of UFL or basix overwriting the one provided by ubuntu/debian, e.g. in your $HOME/.local. If so, make sure to uninstall it.

Thank you for your response @Martin1 @francesco-ballarin! I am using dolfinx v0.8.0. And the error has been solved by reinstalling the fenicsx V0.8.0.