Can not import name

As you are trying to use legacy fenics, you need to use a specific branch of ufl: Configure Mixed Dimensional Branch with ParMETIS - #7 by dokken

Please note that we advice all new users to use DOLFINx and not DOLFIN, Ref: The new DOLFINx solver is now recommended over DOLFIN