Skip to content

INSTALL: older version of petsc will cause error for building petsc4py #4242

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

Closed
scaomath opened this issue Apr 22, 2025 · 4 comments
Closed

Comments

@scaomath
Copy link

Describe the error
I recently updated to a fresh install of Ubuntu 24.04, and installed petsc last month. Upon installing Firedrake today, I tried first using the environment variable pointing to the installed petsc (version 3.22.2). However, Firedrake installing script will give the following error:
Failed to build petsc4py ERROR: Could not build wheels for petsc4py, which is required to install pyproject.toml-based projects
Upon re-installing the correct version of petsc 4.23 according to pyproject.toml, everything is good. Note this is not necessarily a bug for Firedrake installing script. This issue is more like a feature request.

Steps to Reproduce

  1. Install petsc with a version, say 3.22.2.
  2. Install Firedrake by cloning the latest Github repo, with requirements pointing to a different version of petsc4py.
  3. Building wheel will fail for petsc4py.

Expected behavior
I suggest adding some version check on petsc against the Python bindings petsc4py slepc4py used in pyproject.toml.

Environment:

  • OS: Ubuntu 24.04
  • Python version: I tried 3.11.12 first, then 3.10.17, the error persits so I figured it might be something else.
@connorjward
Copy link
Contributor

I have added something in #4194, but this unfortunately isn't something Firedrake can truly fix. You would have observed the same issue if you had simply run

$ pip install petsc4py

By the time Firedrake is installing itself and can check this, petsc4py has either successfully installed or not.

@scaomath
Copy link
Author

@connorjward That is true. That was how I figured out the version discrepancies in the first place. How about adding certain assertions for the version of petsc4py the same with the output of $PETSC_DIR/lib/petsc/bin/petscversion by creating an entrypoint in pyproject.toml? Something like https://setuptools.pypa.io/en/latest/userguide/entry_point.html

@connorjward
Copy link
Contributor

I think I more or less do what you say in #4194 here, but that still won't address the issue of petsc4py not building.

Entrypoints are only available after the installation has completed, so I don't think they will quite work for this.

I think the 'right' solution is for petsc4py to do this check itself. You are more than welcome to submit an issue to them regarding this.

@scaomath
Copy link
Author

Sounds good. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants