Skip to content

Bump PETSc and SLEPc versions #4419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
Merged

Bump PETSc and SLEPc versions #4419

merged 1 commit into from
Jul 3, 2025

Conversation

connorjward
Copy link
Contributor

@connorjward connorjward commented Jul 1, 2025

This should hopefully fix CI. This will require us to make a new patch release.

Justification

Our hand was forced here by the latest releases of PETSc (3.23.4) and SLEPc (3.23.2) and hence the releases of new petsc4py and slepc4py dists on PyPI. The failure we started seeing occurred when importing Firedrake for the first time after install:

Traceback (most recent call last):
  File "/__w/firedrake/firedrake/venv/bin/firedrake-clean", line 5, in <module>
    from firedrake.scripts.firedrake_clean import main
  File "/__w/firedrake/firedrake/venv/lib/python3.12/site-packages/firedrake/__init__.py", line 70, in <module>
    from firedrake.eigensolver import *
  File "/__w/firedrake/firedrake/venv/lib/python3.12/site-packages/firedrake/eigensolver.py", line 11, in <module>
    from slepc4py import SLEPc
  File "/__w/firedrake/firedrake/venv/lib/python3.12/site-packages/slepc4py/SLEPc.py", line 4, in <module>
    SLEPc = ImportSLEPc(ARCH)
            ^^^^^^^^^^^^^^^^^
  File "/__w/firedrake/firedrake/venv/lib/python3.12/site-packages/slepc4py/lib/__init__.py", line 34, in ImportSLEPc
    return Import('slepc4py', 'SLEPc', path, arch)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/firedrake/firedrake/venv/lib/python3.12/site-packages/petsc4py/lib/__init__.py", line 100, in Import
    module = import_module(pkg, name, path, arch)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/firedrake/firedrake/venv/lib/python3.12/site-packages/petsc4py/lib/__init__.py", line 79, in import_module
    spec.loader.exec_module(module)
  File "slepc4py/SLEPc.pyx", line 1, in init slepc4py.SLEPc
AttributeError: module 'petsc4py.PETSc' has no attribute 'SNESLineSearch'. Did you mean: 'TAOLineSearch'?

What is going on here is we are running from slepc4py import SLEPc and hitting an unknown symbol issue.

This is caused by build isolation. Even though petsc4py and slepc4py versions are pinned by Firedrake, when slepc4py is built it fetches its own petsc4py==3.23.4 from upstream and links to that in the isolated build environment. Thus at runtime the petsc4py it now sees (3.23.3) is different to the one it was built against.

Possible solutions are:

  1. Bump all our versions so the build and runtime versions match
  2. Create a constraints file and export PIP_CONSTRAINTS=<that file> to force slepc4py to use the right petsc4py
  3. Only build slepc4py using --no-build-isolation. This means we can't really have pip install firedrake[slepc]

All the solutions suck but the first is the least effort. Hence that is what we are doing here.

@connorjward
Copy link
Contributor Author

connorjward commented Jul 2, 2025

Closing as I think #4421 is a better solution.

If only. Back again.

@connorjward connorjward closed this Jul 2, 2025
@connorjward connorjward reopened this Jul 2, 2025
@connorjward connorjward requested a review from JHopeCollins July 3, 2025 08:14
@JHopeCollins
Copy link
Member

Given this was quite a tricky issue to debug and find a fix for, can you put a description of it in the PR?

@connorjward
Copy link
Contributor Author

Given this was quite a tricky issue to debug and find a fix for, can you put a description of it in the PR?

Good idea. Done.

@dham dham merged commit 1829d99 into release Jul 3, 2025
17 of 21 checks passed
@dham dham deleted the connorjward/bump-slepc4py branch July 3, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants