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
BUG: generate_f2py mod is called by the wrong interpreter #20535
Comments
are you aware of a good alternative? What is there, other than removing the shebang and forcing people to use the |
I guess it is okay for people to use the shebang instead of using Ideas:
|
cc @rgommers |
Hmm, when omitting the
Related: mesonbuild/meson-python#23 Edit: See #20535 (comment) |
Ah, sorry about that - that's a regression indeed. For code generation scripts that don't need numpy/cython, the shebang is preferred. But for these cases that's wrong indeed. That part of gh-20121 should be reverted. I'd like to think a bit more about:
|
This is an unmodified copy from `Cython/Tempita/` as of commit `023d4af35` in Cython's master branch (21 April 2024). Tempita hasn't been maintained independently on PyPI for 10+ years; we've used the Cython version which is semi-public (undocumented) for a while, with the note that we should vendor it if that ever fails. It now failed once (see scipy#20535), and conceptually that makes sense - this is the only place where we don't invoke the `cython` executable but actually do `import Cython`. That can fail in a distro setup where Cython is installed for a different Python interpreter than the active one.
This is an unmodified copy from `Cython/Tempita/` as of commit `023d4af35` in Cython's master branch (21 April 2024). Tempita hasn't been maintained independently on PyPI for 10+ years; we've used the Cython version which is semi-public (undocumented) for a while, with the note that we should vendor it if that ever fails. It now failed once (see scipy#20535), and conceptually that makes sense - this is the only place where we don't invoke the `cython` executable but actually do `import Cython`. That can fail in a distro setup where Cython is installed for a different Python interpreter than the active one. The license file was taken over from the `maintenance/1.26.x` branch in the `numpy` repo - which came from the original upstream repo for Tempita (now disappeared) as discussed in numpy#8096. See scipy#20572 for more clarification about the MIT license that this code is under.
In progress in gh-20612. |
We can use the system
|
Edit: See #20535 (comment) |
I don't think that they are interfering. What happened there is that I only applied the above rules partially before, so inside The added CI job in gh-20612 replicated the exact error you were reporting here, and it was because of the config I summarized here. Once the rules in my comment above were applied, the error went away because the |
But how did it go from the |
It wasn't using the shebang. The current version in |
How is that? From Line 143 in d0ad5aa
scipy/tools/generate_f2pymod.py Line 1 in d0ad5aa
https://mesonbuild.com/Reference-manual_functions.html#find_program
Please don't get me wrong. I am happy that it works, but I want to understand. (See also mesonbuild/meson-python#51) |
I got it. The shebang was never |
Good catch, that makes sense as the difference between build isolation on/off. |
Describe your issue.
Following the fix in #20530 I was able to investigate my build failure with the openSUSE scipy HPC package.
It turns out the reliance on the shebang in tools/generate_f2pymod.sh following #20121 is the culprit. It calls the script with the system
python3
, not respecting any virtual environment or custom build interpreter: The HPC build was setup with numpy for python3.10, but called python3 from 3.11 which did not have a proper HPC numpy in its path.Tempita may have a similar issue:
scipy/scipy/_build_utils/tempita.py
Line 1 in b4f3037
I am able to work around it by adjusting the shebang. But please reconsider hardcoding the interpreter in the vanilla sources.
Reproducing Code Example
Error message
SciPy/NumPy/Python version and system information
EDIT: this bug exists only in scipy 1.13.0; it was fixed in 1.13.1 by reverting the problematic change, and the milestone of this issue is set to 1.14.0 for a different structural fix.
The text was updated successfully, but these errors were encountered: