PETSC error number 11 when running demo_poisson.py

I am running fenics on windows 10 through unbuntu 22.04 in wsl2. I installed it with ppa and then I tried to run the demo_poisson.py, I got the error as follows:
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see FAQ — PETSc 3.19.2 documentation
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.

MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 59.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.

I am a newbie to fenics. I have totally no idea how to fix this issue. can anyone give any hint for me?
thank you.

First of all, are you running legacy fenics or FEniCSx?
Secondly, could you narrow the error message down to a given line in your code?

thank you for your reply.

  1. I installed the fenicsx as follows according to the instruction from GitHub,

The Ubuntu PPA contains binary packages of the FEniCSx components.

To install:

add-apt-repository ppa:fenics-packages/fenics
apt update
apt install fenicsx

so I think I am running FEniCSx, is it right?

  1. I know which line gave the errors, that is
    plotter.show():

so it seems that the fenicsx works well.

This might be up to what settings pyvista is using
Ref Cannot display pyvista plot in docker container - #9 by bay_swiss
and
Problem about pyvista - #3 by dparsons

thank you. I will try to follow that later.

I just ran into another problem:
I tried to run the file of demo_cahn-hilliard.py

the error is:
Traceback (most recent call last):
File “~/Dolfinx/demo_cahn-hilliard.py”, line 126, in
from basix.ufl import mixed_element, element
ModuleNotFoundError: No module named ‘basix.ufl’

I download the demo_cahn-hilliard.py from GitHub.
the module name has been changed?

If you use the PPA packages, you need to checkout the appropriate version of DOLFINx.
I guess that is v0.5.0 or something around that

the command
$dpkg -s fenicsx
gives the following informations:

Package: fenicsx
Status: install ok installed
Priority: optional
Section: math
Installed-Size: 11
Maintainer: Debian Science Team debian-science-maintainers@lists.alioth.debian.org
Architecture: all
Source: fenics
Version: 2:0.5.0.2~ppa1~jammy1

so it is v0.5.0.2?
the demos in GitHub are not compatible with this verson of dolfinx?

The demos that were released with v0.5 are released here: dolfinx/python/demo at v0.5.2 · FEniCS/dolfinx · GitHub