Error after gmshio.model_to_mesh

Did you install dolfinx through conda? I recently got the same error after installing new packages into a previously-working conda environment (which triggered all the fenics-* packages to update). It seems that the workaround you found now results in incompatible versions of dolfinx and basix being installed.

If conda installation is available to you, I can recommend the following, which is based on the workaround you found but explicitly specifies the version and build for all FEniCSx packages to ensure a compatible environment (I prefer to use mamba in place of conda because it solves the environment much faster).

First, install mamba:

conda activate
conda install -c conda-forge mamba

Then copy these commands to a shell script and run it with bash -i <script-name> (the “-i” is needed for the conda activate command to work):

#!/bin/bash

# Select PETSc scalar type and generate environment name
SCALAR_TYPE=real
ENV_NAME="dolfinx-${SCALAR_TYPE}"


# Create list of packages to install, depending on PETSc scalar type.
# The selected packages depend on Python 3.10 and MPICH for MPI communication.
if [[ "$SCALAR_TYPE" == "real" ]]; then
  FENICSX_PKGS="fenics-basix=0.6.0=py310hdf3cbec_0 fenics-dolfinx=0.6.0=py310hf97048e_101 fenics-ffcx=0.6.0=pyh56297ac_0 fenics-libbasix=0.6.0=h1284905_0 fenics-libdolfinx=0.6.0=h4cb9d57_101 fenics-ufcx=0.6.0=h56297ac_0 fenics-ufl=2023.1.1=pyhd8ed1ab_1"
else
  FENICSX_PKGS="fenics-basix=0.6.0=py310hdf3cbec_0 fenics-dolfinx=0.6.0=py310he6dc2dd_1 fenics-ffcx=0.6.0=pyh56297ac_0 fenics-libbasix=0.6.0=h1284905_0 fenics-libdolfinx=0.6.0=hf51c956_1 fenics-ufcx=0.6.0=h56297ac_0 fenics-ufl=2023.1.1=pyhd8ed1ab_1"
fi


# Install packages and activate the new environment
mamba create -y -c conda-forge -n "${ENV_NAME}" $FENICSX_PKGS
conda activate "${ENV_NAME}"
if [[ "$?" == "0" ]]; then
  conda config --env --add channels conda-forge

  # Pin FEniCSx packages
  for PKG in $FENICSX_PKGS; do
    conda config --env --append pinned_packages $PKG
  done

  mamba install -y python-gmsh
else
  echo "Failed to create ${ENV_NAME} environment"
fi

Unfortunately, I can’t test this on MacOS, but hopefully you can make any translations, if needed.

1 Like