The issue seems that openmpi is version 5.x but mpi4py is compiled against version 4.x. You can get a consistent version by using this flag: --with-input=openmpi=openmpi@4.1.6. I could fix the issue with this call:
guix shell python python-mpi4py openmpi \ --with-input=openmpi=openmpi@4.1.6 -- \ mpirun -n 12 python3 ...