Error when using different versions of fenicsx in separate conda environments

I have an issue with some code I have written, that runs perfectly on fenicsx 0.8 installed via conda. I brought that code to another PC which had 0.7.2 so I installed a new environment with fenicsx 0.8. I would like to keep the old environment so my old code still runs (its the idea behind environments afaik).

In the new environment I get cpp errors. I can’t generate the mesh. I suspect it is some kind of installation error. With:

from dolfinx import mesh 
from mpi4py import MPI         
mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)

I get:

terminate called after throwing an instance of 'nanobind::python_error'
  what():  AttributeError: type object 'dolfinx.cpp.mesh.CellType' has no attribute '__qualname__'

Is there a way to do this correctly so I can keep both installations? Am I right that this is actually stemming from having both installed simultaneously?

See Error in model_to_mesh - #7 by jiyeonkim.temp

thanks that was it. Is there a way to set up the conda package so it requires the older version?

don’t know how to do that, cc @minrk

Hi All,
I have the same error even though my mpi4py is version 3.1.6. Also, I only have one version of fenicsx 0.8. I’m trying to run the first tutorial


I’m running python 3.12.4 and Fenicsx packaged by conda-forge (installation method as listed in fenicsx – Nguyen Lab Wiki)
on
Operating System: Ubuntu 22.04.4 LTS
Kernel: Linux 5.15.153.1-microsoft-standard-WSL2
Architecture: x86-64 on a Windows 11 pro.

Please help.

Srikanth

The package metadata was fixed on fenics-dolfin, it should be fixed on fenics-dolfinx shortly