I wish to install a part from the quite outdated Python-Code in 'Principles of Planetary Climate' from Pierrehumbert. For this part gfortran compiler is needed. I once installed gcc. I think it installed gfortran, too (see text from my terminal below). But after the required command according Pierrehumbert 'python setup.py build --lite' I got an error: 'sh: f2py: command not found' Honestly I have no clue what to do next. I'm and remain a rookie in this field of the dependency hell.
Meanwhile I learned: 'The purpose of the F2PY –Fortran to Python interface generator– utility is to provide a connection between Python and Fortran. F2PY is a part of NumPy (numpy.f2py) and also available as a standalone command line tool.' Pierrehumbert's code used numpy 1.17 (I guess). My numpy version is 1.24.3. I had to find a workaround: Pierrehumbert uses numpy.float that doesn't work with numpy 1.24.3. I had to replace it with numpy.float64. With this a great part of Pierrehumbert's code works. Is it possible that Pierrehumbert's code uses an outdated f2py that numpy 1.24.3 doesn't recognise? What is the solution? I really have no clue.
Last login: Mon May 1 19:55:58 on ttys000
widmerhans@Mac-mini-2 ~ % cd /Users/widmerhans/Documents/Python_PRINCIPLES_OF_PLANETARY_CLIMATE_Buch/PlanetaryClimateCourseware/CliMT-master
widmerhans@Mac-mini-2 CliMT-master % python setup.py build --lite
Found executable /usr/local/bin/gfortran
Using gnu95 compiler
src/grid
['src/grid/Driver.f90']
Building _grid.so ...
sh: f2py: command not found
f2py -c -m _grid --fcompiler=gnu95 --noopt -Isrc/grid -Isrc/grid/include -Isrc/grid/src -Isrc/grid/src/include --f77flags="-DIM=1 -DJM=1 -DKM=30 -ffixed-line-length-132 -fdefault-real-8" --f90flags="-DIM=1 -DJM=1 -DKM=30 -fdefault-real-8 -fno-range-check -ffree-form" _grid.pyf src/grid/Driver.f90 src/grid/src/dimensions.F90
sh: f2py: command not found
+++ Compilation failed
widmerhans@Mac-mini-2 CliMT-master %