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

Satish Balay balay.anl at fastmail.org
Thu Aug 28 09:02:08 CDT 2025


On Thu, 28 Aug 2025, Samar Khatiwala via petsc-dev wrote:

> 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?

yes - both petsc and pets4py get spun in the same

>  That is to say, is the version of petsc4py on PyPI designed to be built on top of an existing PETSc installation?

yes.

> Or is that not robust/recommended?

Generally - I think its best to install both - via the same method - i.e install both petsc and petsc4py via pip - or both petsc, petsc4py - naively [with petsc configure option --with-petsc4py=1], or via spack

However I think "pip install petsc4py" should work with a manual install of petsc - there could be some error cases here - perhaps Lisandro or Stefano have more insight on this issue.

Satish


More information about the petsc-dev mailing list