[petsc-dev] Problem pip installing petsc4py on existing PETSc installation

Samar Khatiwala samar.khatiwala at earth.ox.ac.uk
Wed Aug 27 19:51:11 CDT 2025


Hello,

I’m trying to install petsc4py with pip on a machine with an existing PETSc (3.21.1) (installed without pets4py). When I do:

pip install -v petsc4py==3.21.1

the installation fails. (If I don’t specify the version pip just downloads the latest version and the installation fails in a different way, but that’s not surprising.)

I’ve attached the build log.

If I don’t specify PETSC_DIR etc and just do pip install petsc4py then that works. But I would like to use the existing installed PETSc (yes, I know it is quite old but please bear with me!).

A more general question: is the petsc4py packaged with a particular version of PETSc (e.g., in the tarball) identical to the same version on PyPI? That is to say, is the version of petsc4py on PyPI designed to be built on top of an existing PETSc installation? Or is that not robust/recommended?

Thanks very much!

Samar


-------------- next part --------------
A non-text attachment was scrubbed...
Name: log_petsc4py_mypetsc_env.gz
Type: application/x-gzip
Size: 3177 bytes
Desc: log_petsc4py_mypetsc_env.gz
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20250828/31f3cfc0/attachment.gz>


More information about the petsc-dev mailing list