How to get numpy.distutils.fcompiler to find my absoft compiler
Hello everyone, I'm trying to wrap some Fortran77 subroutines from the Math77 library using f2py3. f2py3 responds with a message: File "/Users/user/opt/anaconda3/lib/python3.9/site-packages/numpy/distutils/fcompiler/__init__.py", line 426, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound I'm running Python ver. 3.9.17 under the Anaconda distribution (anaconda Command line client (version 1.12.0)) on a Mac Pro (2019) under Mac OS X Ventura ver. 13.4.1. The Fortran compiler is Absoft Pro Fortran ver. 22.0. The set of subroutines to be wrapped were concatenated into a single file named divapy.f. The command used to wrap the routines was --fcompiler=absoft --f77exec=/Applications/Absoft22.0/bin/f77 -c -m diva divapy.f I've attached a file containing the complete set of messages output by f2py3 using the command above. Any suggestions as to how to fix this problem? Sam Dupree.
More of a workaround, since it seems like the wrappers and binding files are generated could you try the `meson` build following this page in the documentation? https://numpy.org/devdocs/f2py/buildtools/meson.html `distutils` support is patchy at best, but if the meson build doesn't work the bindings might be incorrect, please open an issue in that case. --- Rohit ________________________________ From: Samuel H Dupree Jr <sdupree@speakeasy.net> Sent: Saturday, 29 July 2023 09:33 To: Discussion of Numerical Python Subject: [Numpy-discussion] How to get numpy.distutils.fcompiler to find my absoft compiler Hello everyone, I'm trying to wrap some Fortran77 subroutines from the Math77 library using f2py3. f2py3 responds with a message:
File "/Users/user/opt/anaconda3/lib/python3.9/site-packages/numpy/distutils/fcompiler/__init__.py", line 426, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound
I'm running Python ver. 3.9.17 under the Anaconda distribution (anaconda Command line client (version 1.12.0)) on a Mac Pro (2019) under Mac OS X Ventura ver. 13.4.1. The Fortran compiler is Absoft Pro Fortran ver. 22.0. The set of subroutines to be wrapped were concatenated into a single file named divapy.f. The command used to wrap the routines was
--fcompiler=absoft --f77exec=/Applications/Absoft22.0/bin/f77 -c -m diva divapy.f
I've attached a file containing the complete set of messages output by f2py3 using the command above. Any suggestions as to how to fix this problem? Sam Dupree.
Rohit, Thank you responding to my posting. I attempted to do a 'meson' build. The build failed. The commands I used follow: echo f2py build for divapy echo deleting previous build rm -i *.so rm -i divapy.f rm -i divapy-f2pywrappers.f rm -i divapymodule.c echo concatenating files cat *.f > divapy.f echo building Python wrappers using meson /Users/user/opt/anaconda3/bin/python -m numpy.f2py divapy.f -m divapy --lower meson --wipe builddir meson setup builddir meson compile -C builddir cd builddir /Users/user/opt/anaconda3/bin/python -c 'import divapy' echo done. The meson log file is attached for reference. The output written to the terminal is: The Meson build system Version: 1.1.1 Source dir: /Users/user/Various_Python_Examples/diva.f_for_f2py Build dir: /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir Build type: native build Project name: diva_example Project version: 0.1 C compiler for the host machine: cc (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)") C linker for the host machine: cc ld64 857.1 Host machine cpu family: x86_64 Host machine cpu: x86_64 meson.build:8: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build. Fortran compiler for the host machine: gfortran (gcc 13.1.0 "GNU Fortran (Homebrew GCC 13.1.0) 13.1.0") Fortran linker for the host machine: gfortran ld64 857.1 Program python3 found: YES (/usr/local/opt/python@3.11/bin/python3.11) Found pkg-config: /usr/local/bin/pkg-config (0.29.2) meson.build:14:15: ERROR: Command `/usr/local/opt/python@3.11/bin/python3.11 -c 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'` failed with status 1. A full log can be found at /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-logs/meson-log.txt WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated. The Meson build system Version: 1.1.1 Source dir: /Users/user/Various_Python_Examples/diva.f_for_f2py Build dir: /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir Build type: native build Project name: diva_example Project version: 0.1 C compiler for the host machine: cc (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)") C linker for the host machine: cc ld64 857.1 Host machine cpu family: x86_64 Host machine cpu: x86_64 meson.build:8: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build. Fortran compiler for the host machine: gfortran (gcc 13.1.0 "GNU Fortran (Homebrew GCC 13.1.0) 13.1.0") Fortran linker for the host machine: gfortran ld64 857.1 Program python3 found: YES (/usr/local/opt/python@3.11/bin/python3.11) Found pkg-config: /usr/local/bin/pkg-config (0.29.2) meson.build:14:15: ERROR: Command `/usr/local/opt/python@3.11/bin/python3.11 -c 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'` failed with status 1. A full log can be found at /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-logs/meson-log.txt ERROR: Current directory is not a meson build directory: `/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir`. Please specify a valid build dir or change the working directory to it. It is also possible that the build directory was generated with an old meson version. Please regenerate it in this case. Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'divapy' done. (base) user@Mac-Pro diva.f_for_f2py % In doing a deeper dive, I found that I have meson installed under Homebrew. Before I open an issue, I'd like to know do I need to have meson and/or meson-python installed under Anaconda? Sam Dupree. On 7/29/23 10:49, Rohit Goswami wrote:
More of a workaround, since it seems like the wrappers and binding files are generated could you try the `meson` build following this page in the documentation?
https://numpy.org/devdocs/f2py/buildtools/meson.html
`distutils` support is patchy at best, but if the meson build doesn't work the bindings might be incorrect, please open an issue in that case.
--- Rohit
------------------------------------------------------------------------ *From:* Samuel H Dupree Jr <sdupree@speakeasy.net> *Sent:* Saturday, 29 July 2023 09:33 *To:* Discussion of Numerical Python *Subject:* [Numpy-discussion] How to get numpy.distutils.fcompiler to find my absoft compiler
Hello everyone,
I'm trying to wrap some Fortran77 subroutines from the Math77 library using f2py3. f2py3 responds with a message:
File "/Users/user/opt/anaconda3/lib/python3.9/site-packages/numpy/distutils/fcompiler/__init__.py", line 426, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound
I'm running Python ver. 3.9.17 under the Anaconda distribution (anaconda Command line client (version 1.12.0)) on a Mac Pro (2019) under Mac OS X Ventura ver. 13.4.1. The Fortran compiler is Absoft Pro Fortran ver. 22.0.
The set of subroutines to be wrapped were concatenated into a single file named divapy.f. The command used to wrap the routines was
--fcompiler=absoft --f77exec=/Applications/Absoft22.0/bin/f77 -c -m diva divapy.f
I've attached a file containing the complete set of messages output by f2py3 using the command above.
Any suggestions as to how to fix this problem?
Sam Dupree.
_______________________________________________ NumPy-Discussion mailing list --numpy-discussion@python.org To unsubscribe send an email tonumpy-discussion-leave@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address:sdupree@speakeasy.net
participants (2)
-
Rohit Goswami
-
Samuel H Dupree Jr