Error reading gmsh mesh

Strangely enough, upgrading mpi4py to 4.0.1 solved the issue for dolfinx 0.9.0 (opposing to recommendation in No attribute '__qualname__' due to mpi4py 4.0.0).

from debian:bookworm

ARG DEBIAN_FRONTEND=noninteractive
ARG BUILD_DIR=/tmp/build

RUN apt-get update -q \
    && apt-get install -qy --no-install-recommends \
    build-essential \
    cmake \
    freecad-python3 \
    git \
    jupyter-console \
    jupyter-notebook \
    libadios-dev \
    libboost-filesystem-dev \
    libboost-timer-dev \
    libgmp-dev \
    libgomp1 \
    libocct-data-exchange-dev \
    libocct-foundation-dev \
    libocct-modeling-algorithms-dev \
    libocct-modeling-data-dev \
    libocct-ocaf-dev \
    libpetsc-complex-dev \
    libpugixml-dev \
    libslepc-complex-dev \
    libspdlog-dev \
    mpi-default-dev \
    pkg-config \
    python3 \
    python3-cffi \
    python3-dev \
    python3-matplotlib \
    python3-petsc4py \
    python3-petsc4py-complex \
    python3-pip \
    python3-pybind11 \
    python3-scipy \
    python3-slepc4py \
    python3-slepc4py-complex \
    && apt-get autoremove \
    && apt-get autoclean \
    && rm -rf /var/lib/apt/lists/* \
    && ln -s libpetsc_complex.so /usr/lib/petscdir/petsc3.18/x86_64-linux-gnu-complex/lib/libpetsc.so \
    && ln -s libslepc_complex.so /usr/lib/slepcdir/slepc3.18/x86_64-linux-gnu-complex/lib/libslepc.so

ENV scalar_type=complex
ENV PETSC_DIR="/usr/lib/petscdir/petsc-$scalar_type"
ENV SLEPC_DIR="/usr/lib/slepcdir/slepc-$scalar_type"
ENV PETSC_ARCH="linux-gnu-$scalar_type-64"
ENV PYTHONPATH="$PETSC_DIR/lib/python3/dist-packages:$SLEPC_DIR/lib/python3/dist-packages"
ENV PKG_CONFIG_PATH="$PETSC_DIR/lib/pkgconfig:$PKG_CONFIG_PATH"
ENV LD_LIBRARY_PATH="$PETSC_DIR/lib:$LD_LIBRARY_PATH"

# v4.13.1
ARG GMSH_URL=https://github.com/live-clones/gmsh.git
ARG GMSH_COMMIT=3862278e6705ecc0f5d32144289635a34f5d90cb

RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${GMSH_URL} \
    && git fetch origin ${GMSH_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_TESTING=OFF \
    -DENABLE_BUILD_SHARED=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_FLTK=OFF \
    -DENABLE_WRAP_PYTHON=ON \
    -DENABLE_NUMPY=ON \
    -DENABLE_NETGEN=ON \
    -DENABLE_OCC=ON \
    && cmake --build build -j$(nproc) \
    && cmake --install build \
    && cd / \
    && rm -rf ${BUILD_DIR}

# v2.2.0
ARG NANOBIND_URL=https://github.com/wjakob/nanobind.git
ARG NANOBIND_COMMIT=784efa2a0358a4dc5432c74f5685ee026e20f2b6

RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${NANOBIND_URL} \
    && git fetch origin ${NANOBIND_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && git submodule update --init \
    && mkdir build \
    && cmake -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -B build -S . \
    && cmake --build build -j$(nproc) \
    && cmake --install build \
    && pip3 install --break-system-packages . \
    && cd / \
    && rm -rf ${BUILD_DIR}

# v4.0.1
ARG MPI4PY_URL=https://github.com/mpi4py/mpi4py.git
ARG MPI4PY_COMMIT=e09824346446d26de63e72ffd64b4c388313c2fa
RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${MPI4PY_URL} \
    && git fetch origin ${MPI4PY_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && mkdir build \
    && pip3 install --break-system-packages . \
    && cd / \
    && rm -rf ${BUILD_DIR}

# v0.9.0
ARG BASIX_URL=https://github.com/FEniCS/basix.git
ARG BASIX_COMMIT=19555f5b629b4090b14014f9db5f2c9ac80984f9

RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${BASIX_URL} \
    && git fetch origin ${BASIX_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && mkdir build \
    && cmake -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -B build -S . \
    && cmake --build build -j$(nproc) \
    && cmake --install build \
    && pip3 install --break-system-packages . \
    && cd / \
    && rm -rf ${BUILD_DIR}

# 2024.2.0
ARG UFL_URL=https://github.com/FEniCS/ufl.git
ARG UFL_COMMIT=8ddb83037009d88d6cf67811f90766d7a0159c3c

RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${UFL_URL} \
    && git fetch origin ${FFCX_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && pip3 install --break-system-packages . \
    && cd / \
    && rm -rf ${BUILD_DIR}

# v0.9.0
ARG FFCX_URL=https://github.com/FEniCS/ffcx.git
ARG FFCX_COMMIT=2ef366842d1ea5faf053d201364df66f6a693819

RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${FFCX_URL} \
    && git fetch origin ${FFCX_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && pip3 install --break-system-packages . \
    && cd / \
    && rm -rf ${BUILD_DIR}

# v0.9.0.post1
ARG DOLFIN_URL=https://github.com/FEniCS/dolfinx.git
ARG DOLFIN_COMMIT=a1bd6f697e1784c7001caf9ebb32673b1fb22412

RUN mkdir ${BUILD_DIR} \
    && cd ${BUILD_DIR} \
    && git init --initial-branch=master \
    && git remote add origin ${DOLFIN_URL} \
    && git fetch origin ${DOLFIN_COMMIT} \
    && git reset --hard FETCH_HEAD \
    && mkdir build \
    && cmake -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -B build -S ./cpp \
    && cmake --build build -j$(nproc) \
    && cmake --install build \
    && . /usr/lib/x86_64-linux-gnu/dolfinx/dolfinx.conf \
    && pip3 install --break-system-packages ./python \
    && cd / \
    && rm -rf ${BUILD_DIR}

run find /usr/share/freecad/Mod/ -maxdepth 1 -type d \
    > /usr/lib/python3/dist-packages/freecad.pth \
    && echo /usr/share/freecad/Ext \
    >> /usr/lib/python3/dist-packages/freecad.pth \
    && echo /usr/lib/freecad-python3/lib \
    >> /usr/lib/python3/dist-packages/freecad.pth \
    && echo /lib/x86_64-linux-gnu \
    > /usr/lib/python3/dist-packages/gmsh.pth

RUN useradd -m user \
    && mkdir /home/user/work \
    && chown user:user /home/user/work

COPY start.sh /start.sh

USER user
WORKDIR /home/user
ENTRYPOINT /start.sh
EXPOSE 8888