ModuleNotFoundError: No module named 'dolfinx.cpp.fem.petsc' in Spack-based FEniCSx installation

Hi all,
I’m using a Spack-based installation of FEniCSx on HPC with the following setup:
• py-fenics-dolfinx@main installed via Spack
• python@3.10
• gcc@14.2.0, cmake@3.31.6, ninja@1.12.1, openmpi@5.0.7
• FEniCSx loads fine and print(dolfinx.version) outputs 0.10.0.0

However, when running a script that uses the nonlinear solver:
from dolfinx.nls.petsc import NewtonSolver
I get the following error:
ModuleNotFoundError: No module named ‘dolfinx.cpp.fem.petsc’; ‘dolfinx.cpp.fem’ is not a package

Did you try the instructions at:

i.e.

spack add fenics-dolfinx+petsc+adios2 py-fenics-dolfinx@main cflags="-O3" fflags="-O3"

As PETSc is optional it needs to explicitly stated.