`FC` environment variable needs to be defined with Python >= 3.12
Currently, build fails with Python 3.12 and Numpy 1.26:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/work/opentelemac/scripts/python3/compile_telemac.py", line 142, in <module>
main()
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/work/opentelemac/scripts/python3/compile_telemac.py", line 134, in main
compile_api_files(silent=not options.verbose,
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/work/opentelemac/scripts/python3/compilation/compil_tools.py", line 1038, in compile_api_files
compile_api_f2py('api', api_dir, source_api, skip_source, ld_flags,
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/work/opentelemac/scripts/python3/compilation/compil_tools.py", line 986, in compile_api_f2py
raise TelemacException(\
utils.exceptions.TelemacException: Error during the second part of F2PY: 1
Cannot use distutils backend with Python 3.12, using meson backend instead.Traceback (most recent call last):
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/[...]/bin/f2py", line 10, in <module>
sys.exit(main())
^^^^^^
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/[...]/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 732, in main
run_compile()
File "/home/conda/staged-recipes/build_artifacts/opentelemac_1700389254610/[...]/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 610, in run_compile
from numpy.distutils import fcompiler
ModuleNotFoundError: No module named 'numpy.distutils'
refs:
- https://numpy.org/doc/stable/reference/distutils.html
- https://github.com/numpy/numpy/issues/24838
- https://github.com/numpy/numpy/pull/25123
It will raise an error in Numpy 1.26.3.
Solution:
- Define
FC
when running f2py commands (f2py_name: FC=gfortran f2py
?) for Python >=3.12