No attribute '__qualname__' due to mpi4py 4.0.0

,

Hello, all.
When I run Electromagnetics examples in Fenicsx tutorial,

terminate called after throwing an instance of ‘nanobind::python_error’
AttributeError: type object ‘dolfinx.cpp.fem.CoordinateElement_float32’ has no attribute ‘qualname

appears due to execution of the following code.

mesh, ct, _ = model_to_mesh(gmsh.model, mesh_comm, model_rank, gdim=2)

2 Likes

That’s definitely a new one to me. Please report how you installed dolfinx.

1 Like

Thank you for paying attention. I followed instruction fenicsx – Nguyen Lab Wiki

You’d have to be more specific, since there are several different options there, depending on your operating system.

Hi,

I have the same error when I use

from dolfinx.io import gmshio
from mpi4py import MPI
#
gmsh_model_rank = 0
mesh_comm       = MPI.COMM_WORLD
mesh, domains, boundaries = gmshio.read_from_msh("square.msh", mesh_comm, gmsh_model_rank, gdim=2)

I get

Info    : Reading 'square.msh'...
Info    : 9 entities
Info    : 142 nodes
Info    : 282 elements
Info    : Done reading 'square.msh'
libc++abi: terminating due to uncaught exception of type nanobind::python_error: AttributeError: type object 'dolfinx.cpp.fem.CoordinateElement_float32' has no attribute '__qualname__'
Abort trap: 6

I have version 0.8 installed in a M2 mac using conda as indicated in the offial web page of Fenicsx.

Regards,

Rodolfo

My system is Windows 10, ubuntu 22.04.4 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64) and i used conda forge method.

domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral)
I found that above line produces the simillar error.

terminate called after throwing an instance of ‘nanobind::python_error’
what(): AttributeError: type object ‘CellType’ has no attribute ‘qualname

I found the problem. mpi4py was upgraded from v3.1.6 to v4.0.0 in July28, 2024.
Downgrading the mpi4py from v4.0.0 to v3.1.6 works fine for me. :slight_smile:

3 Likes

How to downgrade the version from v4 to v3? I am using Mac M2. Thank you.

pip install 'mpi4py<4'?

1 Like

Hi,
I experienced the same error with the very line of code, and your solution worked for me, as well.
Thank you.

1 Like