Skip to content
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

f2py-f90wrap v0.2.15 now leads to "Fatal Error: Cannot open module file xyz.mod’ for reading" #226

Open
jmp75 opened this issue Sep 9, 2024 · 2 comments

Comments

@jmp75
Copy link
Contributor

jmp75 commented Sep 9, 2024

I am not sure this is a f90wrap issue per se, but want to report it in case others bump into this issue. It may be a side effect of numpy f2py now relying on meson to build stuff.

Issue

I have a python wrapper in jmp75/air2stream at commit 02fc71 that builds fine in a conda environment that includes:

f90wrap                   0.2.13 
numpy                     1.26.0 
python                    3.9.16

I am trying to run the same wrapping build script into a new environment with:

python                    3.12.5
f90wrap                   0.2.15
numpy                     2.1.1
meson                     1.5.1  # now required by numpy-f2py it seems

This fails in the script regen_wrapper.sh at the step calling f2py-f90wrap:

[2/7] Compiling Fortran object _a2s.cpython-312-x86_64-linux-gnu.so.p/f90wrap_AIR2STREAM_MODULES.f90.o
FAILED: _a2s.cpython-312-x86_64-linux-gnu.so.p/f90wrap_AIR2STREAM_MODULES.f90.o 
gfortran -I_a2s.cpython-312-x86_64-linux-gnu.so.p -I. -I.. -I/home/abcdef/miniforge3/envs/a2s/lib/python3.12/site-packages/numpy/_core/include -I/home/abcdef/miniforge3/envs/a2s/lib/python3.12/site-packages/numpy/f2py/src -I/home/abcdef/miniforge3/envs/a2s/include/python3.12 -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -O3 -fPIC -J_a2s.cpython-312-x86_64-linux-gnu.so.p -o _a2s.cpython-312-x86_64-linux-gnu.so.p/f90wrap_AIR2STREAM_MODULES.f90.o -c ../f90wrap_AIR2STREAM_MODULES.f90
../f90wrap_AIR2STREAM_MODULES.f90:4:9:

    4 |     use commondata, only: commondata_n_par => n_par
      |         1
Fatal Error: Cannot open module file ‘commondata.mod’ for reading at (1): No such file or directory
compilation terminated.
[3/7] Compiling Fortran object _a2s.cpython-312-x86_64-linux-gnu.so.p/_a2s-f2pywrappers.f.o
[4/7] Compiling Fortran object _a2s.cpython-312-x86_64-linux-gnu.so.p/f90wrap_toplevel.f90.o
[5/7] Compiling C object _a2s.cpython-312-x86_64-linux-gnu.so.p/6a58a1f4e765b29ba60324f015623347fad0725c_.._.._f2py_src_fortranobject.c.o
[6/7] Compiling C object _a2s.cpython-312-x86_64-linux-gnu.so.p/_a2smodule.c.o
ninja: build stopped: subcommand failed.
@jmp75
Copy link
Contributor Author

jmp75 commented Sep 9, 2024

I can confirm this looks like a side effect of numpy f2py move to meson, which seems compulsory with python>=3.12. The following downgrade fixes my issue:

mamba uninstall meson
mamba install python=3.11

@jameskermode
Copy link
Owner

Thanks for reporting. f90wrap also depends on and uses Meson as its build system, so this should not directly be the reason for the problem, but it could very well be that the changes to f2py which has broken the monkey-patching done by f2py-f90wrap.

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

No branches or pull requests

2 participants