This is a large part of the problem. In general, you never want to use pip to install complex packages (packages involving compiled binary libraries). The pusimp error explains the problem.
Edit: /usr/lib/petsc/lib/python3/dist-packages/dolfinx/__init__.py is correct (I missed petsc in the middle in my first reading).
Hi, thank you for the prompt reply: I tried this and it didn’t change the error message. After typing this I get the following:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
python3-basix is already the newest version (0.8.0-3~ppa1~jammy2).
0 upgraded, 0 newly installed, 0 to remove and 98 not upgraded.