-
Notifications
You must be signed in to change notification settings - Fork 1
Fail nicely when trying to use petsc4py methods without petsc4py available #6
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
Conversation
JHopeCollins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good addition, thanks @connorjward.
I just have one suggestion to improve the error message even further, other than that I think it's good to go.
For the record, if I "forget" to pass --no-build-isolation with the current petsctools main branch then I get this error:
AttributeError: module 'petsctools' has no attribute 'init'
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Whereas if I "forget" using this branch then I get:
ImportError: Cannot load 'init' from module 'petsctools' because petsc4py is not available
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Co-authored-by: Josh Hope-Collins <jhc.jss@gmail.com>
JHopeCollins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed a syntax error in my suggestion. LGTM now.
This is particularly important for when someone forgets to pass
--no-build-isolationwhen pip installing firedrake (or some other downstream library). Ifpetsc4pyisn't in the isolated build environment then you get an unhelpful missing attribute error forpetsctools.init, which doesn't explain whyinitis missing`.