PETSc Error 11 while running demo_poisson

I have installed fenicsx 0.9.0 on my MacBook Pro M4 recently and tried to run the Poisson Demo. However, I get the following error:

[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation

The demo is not edited and the error occurs at the following line in demo_poisson.py:

problem = LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})

I can supply all of the error message if it is needed.

Best,

Could you try to modify

to
LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu", "pc_factor_mat_solver_type": "mumps", "ksp_error_if_not_converged": True })

Additionally, it would be helpful to know how you installed dolfinx.

I modified it and it resulted with the same error message.

I initially installed DOLFINx from source without PETSc, and it worked without any issues. Later, I installed PETSc via Homebrew and petsc4py via pip, then reinstalled DOLFINx from the source. After that, I encountered this error.

Did you make sure to clear your old dolfinx include files fully?

Also, if the dolfinx code above when you did not have PETSC installed, you must have had a PETSC installation somewhere else, as LinearProblem relies on PETSC and petsc4py.