-
Notifications
You must be signed in to change notification settings - Fork 99
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
Inconsistent f2py wrappers #681
Comments
For reference, the errors you will get at run time because of this are things like this:
|
@mandli @rjleveque please let me know if you've seen this issue before. |
Yup, I have. Not sure how I got around it now off-hand as I have not seen it in awhile. |
Perhaps it would be worthwhile to "fix" this by inserting try-except blocks around the relevant function calls, with the alternative function signature in the except block. It's not pretty but it would solve this problem, which I suspect has affected others who we're not aware of. |
Not ideal for sure. Have you seen the issue lately? It would be good to have some case that is reproducible. |
I haven't seen it, but have not been importing pyclaw solvers recently. |
I currently have this issue on two machines. Both are macbooks, but they differ in a lot of other ways. One is running Mojave; the other Big Sur. We've tried different Python versions 3.7-3.10 with no change. Different versions of Gfortran. Different versions of numpy (including the latest release). We've reached the point of patching it locally because we haven't figured out what causes it or how to fix it. |
This seems to be a bug due to fairly recent changes in numpy. Rolling back to Numpy 1.18.5 fixed it for me. I've opened an issue in the numpy repository. |
Assuming you meant numpy, my version is 1.21.5 and passes all nosetests except for the test tolerance problem. |
LOL, yes I did not mean to suggest rolling back to Python 1! |
And using a recent version of numpy seems to be a necessary but not sufficient condition for triggering the bug. |
I can't reproduce this on NumPy
|
In our experience the bug is not consistent. The function signature produced by f2py is different on different machines. But using numpy 1.18 always fixes it, and we've found no other way to fix it. |
Hello, recently I was working with pyclaw and I got the same problem, what I did to solve it was to download the complete clawpack (.tar for example) copy the files step1.f90, step2.f90 (and others) in the pyclaw/classic folder and recompile them with the setup.py, that step will generate the files classic1, classic2, classic3 in the build folder, then replace them and the problem is solved. |
This seems so odd with the version differences mattering. I do not see anything off-hand that would suggest that the parsing in |
After more investigation, it seems that this bug is already fixed in the current dev version of numpy. The bug exists only in the 1.22.x releases. We might want to add a warning on the Clawpack installation pages, advising people to avoid using numpy 1.22.x. Hopefully 1.23 will be released very soon. |
This is an issue that has been encountered by myself and @carlosmunozmoncayo on different machines.
Doing
at an IPython prompt shows the signature for the wrapper of the
step1
function generated by f2py, which should beHowever, on the machines in question, it is instead
In the latter case, f2py is inferring the values of
num_ghost
andmx
instead of requiring that they be passed. This would be fine, but it breaks PyClaw since the signature ofstep1
is now different and the way it is called from Python is wrong.I have experimented with different versions of Python, numpy, and gfortran, but haven't yet found what causes this problem. Has anyone else seen it?
The text was updated successfully, but these errors were encountered: