keflavich / pyradex

Python interface to RADEX
BSD 3-Clause "New" or "Revised" License
18 stars 12 forks source link

Error appears during pyradex installation #39

Open fsalvest opened 1 year ago

fsalvest commented 1 year ago

Hi to everybody,

I failed several times in installing pyradex. I have a macbook pro with Python 3.7.13 numpy 1.21.5 astropy 4.3.1 GNU Fortran (GCC) 11.2.0

After having installed astroquery and specutils, I cloned pyradex from the repository. Then I run "python setup.py install_radex install_myradex install", but the installation is interrupted by this message:

outfile = [] error: Did not find the correct .so file(s)! Compilation has failed.

What can I do? Thank you for your help!

keflavich commented 1 year ago

Seems to be caused by an issue like this one: https://github.com/ponylang/ponyc/issues/3684 Should now be fixed with this commit: e07704d

fsalvest commented 1 year ago

Seems to be caused by an issue like this one: ponylang/ponyc#3684 Should now be fixed with this commit: e07704d

Dear Adam, thank you for your fast reply. I tried fixing install_radex.py as you suggested, but I get the same Error.

keflavich commented 1 year ago

Could you please post the full error? There should be much more to the message than what you showed.

fsalvest commented 1 year ago

The following are the very last part of the messages printed on the terminal. I scrolled over the more than 700 lines, but no error messages are reported. Many thanks for your time and help!

Wrote C/API module "radex" to file "/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/radexmodule.c"
Fortran 77 wrappers are saved to "/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/radex-f2pywrappers.f"

adding '/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/fortranobject.c' to sources. adding '/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7' to include_dirs. copying /Users/home/opt/anaconda3/envs/pyradex_demo/lib/python3.7/site-packages/numpy/f2py/src/fortranobject.c -> /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7 copying /Users/home/opt/anaconda3/envs/pyradex_demo/lib/python3.7/site-packages/numpy/f2py/src/fortranobject.h -> /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7 adding '/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/radex-f2pywrappers.f' to sources. build_src: building npy-pkg config files running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext customize Gnu95FCompiler Found executable /Users/home/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran Found executable /Users/home/opt/anaconda3/envs/pyradex_demo/bin/x86_64-apple-darwin13.4.0-ld Found executable /Users/home/opt/anaconda3/envs/pyradex_demo/bin/x86_64-apple-darwin13.4.0-ar Found executable /Users/home/opt/anaconda3/envs/pyradex_demo/bin/x86_64-apple-darwin13.4.0-ranlib customize Gnu95FCompiler using build_ext building 'radex' extension compiling C sources C compiler: x86_64-apple-darwin13.4.0-clang -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O3 -pipe -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=/Users/home/opt/anaconda3/envs/pyradex_demo=/usr/local/src/conda-prefix -flto -Wl,-export_dynamic -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/home/opt/anaconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/home/opt/anaconda3/include

creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var/folders creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var/folders/m9 creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax creating /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7 compile options: '-DNPY_DISABLE_OPTIMIZATION=1 -I/Users/home/RADEX/pyradex/Radex/src -I/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7 -I/Users/home/opt/anaconda3/envs/pyradex_demo/lib/python3.7/site-packages/numpy/core/include -I/Users/home/opt/anaconda3/envs/pyradex_demo/include/python3.7m -c' x86_64-apple-darwin13.4.0-clang: /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/radexmodule.c x86_64-apple-darwin13.4.0-clang: /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/fortranobject.c compiling Fortran sources Fortran f77 compiler: /Users/home/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran -fno-automatic -fPIC -march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/home/opt/anaconda3/include -O3 -funroll-loops Fortran f90 compiler: /Users/home/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -fno-second-underscore -fPIC -march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/home/opt/anaconda3/include -O3 -funroll-loops Fortran fix compiler: /Users/home/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -fPIC -march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/home/opt/anaconda3/include -O3 -funroll-loops compile options: '-I/Users/home/RADEX/pyradex/Radex/src -I/var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7 -I/Users/home/opt/anaconda3/envs/pyradex_demo/lib/python3.7/site-packages/numpy/core/include -I/Users/home/opt/anaconda3/envs/pyradex_demo/include/python3.7m -c' x86_64-apple-darwin13.4.0-gfortran:f77: /var/folders/m9/jbqkxbmd265mvfzkjvw34dr0000gq/T/tmpnoltqy9.f x86_64-apple-darwin13.4.0-gfortran:f77: /var/folders/m9/jbqkxbmd265_mvfzkjvw34dr0000gq/T/tmp49_gplax/src.macosx-10.9-x86_64-3.7/radex-f2pywrappers.f

outfile = [] error: Did not find the correct .so file(s)! Compilation has failed.

keflavich commented 1 year ago

I get the same traceback and error if I have the wrong SDK root specified (SDK = Software Development Kit, by mac). Try setting the variable with this command:

export SDKROOT=$(xcrun -sdk macosx --show-sdk-path)

and then re-try installing.

fsalvest commented 1 year ago

Neither this last suggestion worked, I get the same error. I also tried to install the code in a new conda environment, but it was an unsuccessful try.

keflavich commented 1 year ago

I'm out of ideas of things to change, then. You could try running f2py yourself.

cd radex/src
f2py -m radex *.f

...there are some more arguments I have to look up, but you could reconstruct them from the install script

keflavich commented 1 year ago

@fsalvest the problem appears to be with numpy 1.24. Try downgrading to 1.23.

keflavich commented 1 year ago

You might need to use this command:

f2py -c -m radex --f77flags=-fno-automatic --fcompiler=gfortran -I/Users/adam/repos/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib *.f

in the Radex/src directory. I haven't yet figured out what's going wrong with the f2py.compile command, but something is.

fsalvest commented 1 year ago

Your solution works! I finally got this message: "Installation has completed. Make sure to set your RADEX_DATAPATH variable!".

f2py -c -m radex --f77flags=-fno-automatic --fcompiler=gfortran -I/Users/adam/repos/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib *.f

I run this command in "Radex/src", but in a new conda environment, with python 3.10.9 and numpy 1.23.5. I don't know why the code could not run in my base environment (info at the top of the thread).

Thank you very much for your help!

XFengwei commented 1 year ago

f2py -m radex *.f

After running this command, some warnings occur. But what should I do then?

XFengwei commented 1 year ago

You might need to use this command:

f2py -c -m radex --f77flags=-fno-automatic --fcompiler=gfortran -I/Users/adam/repos/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib *.f

in the Radex/src directory. I haven't yet figured out what's going wrong with the f2py.compile command, but something is.

Sorry I quote the wrong command line above, I meant this command.

keflavich commented 1 year ago

if you're just getting warnings, that means everything is OK - there are supposed to be tons of warnings. If you get an error, otoh, that means something has gone wrong. If you get an error, please report it.

XFengwei commented 1 year ago

Oh, I meant I had run the command: "f2py -c -m radex --f77flags=-fno-automatic --fcompiler=gfortran -I/Users/adam/repos/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib *.f"

And only warnings, no errors.

So the next step, there seems to be a complied file "radex.cpython-39-darwin.so" in Radex/src/. I should move it to the pyradex/radex?

keflavich commented 1 year ago

Good, that means it worked!

Did running python setup.py install_radex not work, though? That should handle moving files to the right location.

But yes, that's where it should go.

XFengwei commented 1 year ago

Yes. After "mv Radex/src/*so pyradex/radex/", I rerun the "python setup.py install_radex", still the same error as follows

/Users/maple/opt/anaconda3/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) running install_radex Downloading RADEX Download succeeded, or at least didn't obviously fail. Extracting RADEX source from file /Users/maple/.astropy/cache/download/url/df9a6b344f9b6851d8c799789754b74e/contents Reading fortran codes... Reading file 'main.f' (format:fix,strict) Reading file 'radex.inc' (format:fix) Line #25 in main.f:" integer niter ! iteration counter" updatevars: could not crack entity declaration "niter!". Ignoring. Line #26 in main.f:" integer imore ! are we running again?" updatevars: could not crack entity declaration "imore!". Ignoring. Line #26 in main.f:" integer imore ! are we running again?" updatevars: could not crack entity declaration "again?". Ignoring. Line #29 in main.f:" logical conv ! are we converged?" updatevars: could not crack entity declaration "conv!". Ignoring. Line #29 in main.f:" logical conv ! are we converged?" updatevars: attempt to change the type of "are" ("integer") to "logical". Ignoring. Line #29 in main.f:" logical conv ! are we converged?" updatevars: attempt to change the type of "we" ("integer") to "logical". Ignoring. Line #29 in main.f:" logical conv ! are we converged?" updatevars: could not crack entity declaration "converged?". Ignoring. Reading file 'background.f' (format:fix,strict) Reading file 'radex.inc' (format:fix) Reading file 'radex.inc' (format:fix) Reading file 'slatec.f' (format:fix,strict) Reading file 'matrix.f' (format:fix,strict) Reading file 'radex.inc' (format:fix) Line #25 in matrix.f:" integer niter ! iteration counter" updatevars: could not crack entity declaration "niter!". Ignoring. Line #26 in matrix.f:" integer ilev,jlev,klev ! to loop over energy levels" updatevars: could not crack entity declaration "klev!". Ignoring. Line #27 in matrix.f:" integer nplus ! to solve statistical equilibrium" updatevars: could not crack entity declaration "nplus!". Ignoring. Line #28 in matrix.f:" integer iline ! to loop over lines" updatevars: could not crack entity declaration "iline!". Ignoring. Line #29 in matrix.f:" integer m,n ! line upper/lower levels" updatevars: could not crack entity declaration "n!". Ignoring. Line #29 in matrix.f:" integer m,n ! line upper/lower levels" updatevars: could not crack entity declaration "upper/lower". Ignoring. Line #30 in matrix.f:" integer nthick ! counts optically thick lines" updatevars: could not crack entity declaration "nthick!". Ignoring. Line #31 in matrix.f:" integer nfat ! counts highly optically thick lines" updatevars: could not crack entity declaration "nfat!". Ignoring. Line #32 in matrix.f:" integer nreduce ! size of reduced rate matrix" updatevars: could not crack entity declaration "nreduce!". Ignoring. rmbadname1: Replacing "size" with "size_bn". Line #34 in matrix.f:" integer indx,dsign ! needed for NumRep equation solver" updatevars: could not crack entity declaration "dsign!". Ignoring. rmbadname1: Replacing "for" with "for_bn". Line #35 in matrix.f:" real8 rhs(maxlev) ! RHS of rate equation" updatevars: could not crack entity declaration "rhs(maxlev)!". Ignoring. Line #35 in matrix.f:" real8 rhs(maxlev) ! RHS of rate equation" updatevars: attempt to change the type of "of" ("integer") to "real". Ignoring. Line #35 in matrix.f:" real8 rhs(maxlev) ! RHS of rate equation" updatevars: attempt to change the type of "rate" ("integer") to "real". Ignoring. Line #35 in matrix.f:" real8 rhs(maxlev) ! RHS of rate equation" updatevars: attempt to change the type of "equation" ("integer") to "real". Ignoring. Line #37 in matrix.f:" real8 yrate(maxlev,maxlev) ! rate matrix" updatevars: could not crack entity declaration "yrate(maxlev,maxlev)!". Ignoring. Line #37 in matrix.f:" real8 yrate(maxlev,maxlev) ! rate matrix" updatevars: attempt to change the type of "rate" ("integer") to "real". Ignoring. Line #37 in matrix.f:" real8 yrate(maxlev,maxlev) ! rate matrix" updatevars: attempt to change the type of "matrix" ("integer") to "real". Ignoring. Line #38 in matrix.f:" real8 etr,exr ! to calculate radiative rates" updatevars: could not crack entity declaration "exr!". Ignoring. Line #38 in matrix.f:" real8 etr,exr ! to calculate radiative rates" updatevars: attempt to change the type of "to" ("integer") to "real". Ignoring. Line #39 in matrix.f:" real8 xt ! frequency cubed" updatevars: could not crack entity declaration "xt!". Ignoring. Line #40 in matrix.f:" real8 hnu ! photon energy" updatevars: could not crack entity declaration "hnu!". Ignoring. Line #40 in matrix.f:" real8 hnu ! photon energy" updatevars: attempt to change the type of "energy" ("integer") to "real". Ignoring. Line #41 in matrix.f:" real8 bnutex ! line source function" updatevars: could not crack entity declaration "bnutex!". Ignoring. Line #41 in matrix.f:" real8 bnutex ! line source function" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Line #42 in matrix.f:" real8 cddv ! N(mol) / delta V" updatevars: could not crack entity declaration "cddv!". Ignoring. Line #42 in matrix.f:" real8 cddv ! N(mol) / delta V" updatevars: attempt to change the type of "n" ("integer") to "real". Ignoring. Line #42 in matrix.f:" real8 cddv ! N(mol) / delta V" updatevars: could not crack entity declaration "n(mol)/delta". Ignoring. Line #43 in matrix.f:" real8 beta,escprob ! escape probability" updatevars: could not crack entity declaration "escprob!". Ignoring. Line #45 in matrix.f:" real8 bnu ! Planck function" updatevars: could not crack entity declaration "bnu!". Ignoring. Line #46 in matrix.f:" real8 uarray(maxlev,maxlev) ! reduced rate matrix" updatevars: could not crack entity declaration "uarray(maxlev,maxlev)!". Ignoring. Line #46 in matrix.f:" real8 uarray(maxlev,maxlev) ! reduced rate matrix" updatevars: attempt to change the type of "reduced" ("integer") to "real". Ignoring. Line #46 in matrix.f:" real8 uarray(maxlev,maxlev) ! reduced rate matrix" updatevars: attempt to change the type of "rate" ("integer") to "real". Ignoring. Line #46 in matrix.f:" real8 uarray(maxlev,maxlev) ! reduced rate matrix" updatevars: attempt to change the type of "matrix" ("integer") to "real". Ignoring. Line #47 in matrix.f:" real8 redcrit ! reduction criterion" updatevars: could not crack entity declaration "redcrit!". Ignoring. Line #48 in matrix.f:" real8 sumx ! summed radiative rate" updatevars: could not crack entity declaration "sumx!". Ignoring. Line #48 in matrix.f:" real8 sumx ! summed radiative rate" updatevars: attempt to change the type of "rate" ("integer") to "real". Ignoring. Line #49 in matrix.f:" real8 total ! to normalize populations" updatevars: could not crack entity declaration "total!". Ignoring. Line #49 in matrix.f:" real8 total ! to normalize populations" updatevars: attempt to change the type of "to" ("integer") to "real". Ignoring. Line #51 in matrix.f:" real8 tsum,thistex ! to check convergence" updatevars: could not crack entity declaration "thistex!". Ignoring. Line #51 in matrix.f:" real8 tsum,thistex ! to check convergence" updatevars: attempt to change the type of "to" ("integer") to "real". Ignoring. Line #54 in matrix.f:" logical conv ! are we converged?" updatevars: could not crack entity declaration "conv!". Ignoring. Line #54 in matrix.f:" logical conv ! are we converged?" updatevars: could not crack entity declaration "converged?". Ignoring. Reading file 'radex.inc' (format:fix) Line #329 in matrix.f:" real8 taur !optical radius" updatevars: could not crack entity declaration "taur!optical". Ignoring. Reading file 'io.f' (format:fix,strict) Reading file 'radex.inc' (format:fix) Line #24 in io.f:" integer length ! subroutine to determine" updatevars: could not crack entity declaration "length!". Ignoring. Line #26 in io.f:" integer ipart ! loop over collision partners" updatevars: could not crack entity declaration "ipart!". Ignoring. Line #27 in io.f:" character10 partner ! name of collision partner" updatevars: no name pattern found for entity='!'. Skipping. Line #27 in io.f:" character10 partner ! name of collision partner" updatevars: attempt to change the type of "collision" ("integer") to "character". Ignoring. updatevars:collision: attempt to change empty charselector to {'': '10'}. Ignoring. Line #30 in io.f:" integer id ! ID code of collision partner" updatevars: could not crack entity declaration "id!". Ignoring. Line #30 in io.f:" integer id ! ID code of collision partner" updatevars: attempt to change the type of "of" ("character") to "integer". Ignoring. Line #30 in io.f:" integer id ! ID code of collision partner" updatevars: attempt to change the type of "partner" ("character") to "integer". Ignoring. Reading file 'radex.inc' (format:fix) Line #162 in io.f:" integer ipart ! to loop over collision partners" updatevars: could not crack entity declaration "ipart!". Ignoring. Reading file 'radex.inc' (format:fix) Line #201 in io.f:" integer iline ! to loop over lines" updatevars: could not crack entity declaration "iline!". Ignoring. Line #202 in io.f:" integer m,n ! upper & lower level of the line" updatevars: could not crack entity declaration "n!". Ignoring. Line #202 in io.f:" integer m,n ! upper & lower level of the line" updatevars: no name pattern found for entity='&'. Skipping. Line #204 in io.f:" integer niter ! final number of iterations" updatevars: could not crack entity declaration "niter!". Ignoring. Line #208 in io.f:" real8 xt ! frequency cubed" updatevars: could not crack entity declaration "xt!". Ignoring. Line #209 in io.f:" real8 hnu ! photon energy" updatevars: could not crack entity declaration "hnu!". Ignoring. Line #210 in io.f:" real8 bnutex ! line source function" updatevars: could not crack entity declaration "bnutex!". Ignoring. Line #210 in io.f:" real8 bnutex ! line source function" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Line #211 in io.f:" real8 ftau ! exp(-tau)" updatevars: could not crack entity declaration "ftau!". Ignoring. Line #212 in io.f:" real8 toti ! background intensity" updatevars: could not crack entity declaration "toti!". Ignoring. Line #213 in io.f:" real8 tbl ! black body temperature" updatevars: could not crack entity declaration "tbl!". Ignoring. Line #214 in io.f:" real8 wh ! Planck correction" updatevars: could not crack entity declaration "wh!". Ignoring. Line #215 in io.f:" real8 tback ! background temperature" updatevars: could not crack entity declaration "tback!". Ignoring. Line #216 in io.f:" real8 ta ! line antenna temperature" updatevars: could not crack entity declaration "ta!". Ignoring. Line #216 in io.f:" real8 ta ! line antenna temperature" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Line #217 in io.f:" real8 tr ! line radiation temperature" updatevars: could not crack entity declaration "tr!". Ignoring. Line #217 in io.f:" real8 tr ! line radiation temperature" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Line #218 in io.f:" real8 beta,escprob ! escape probability" updatevars: no name pattern found for entity='!'. Skipping. Line #220 in io.f:" real8 bnu ! Planck function" updatevars: could not crack entity declaration "bnu!". Ignoring. Line #221 in io.f:" real8 kkms ! line integrated intensity (K km/s)" updatevars: could not crack entity declaration "kkms!". Ignoring. Line #221 in io.f:" real8 kkms ! line integrated intensity (K km/s)" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Line #222 in io.f:" real8 ergs ! line flux (erg / s / cm^2)" updatevars: could not crack entity declaration "ergs!". Ignoring. Line #222 in io.f:" real8 ergs ! line flux (erg / s / cm^2)" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Line #227 in io.f:" real8 wavel ! line wavelength (micron)" updatevars: could not crack entity declaration "wavel!". Ignoring. Line #227 in io.f:" real8 wavel ! line wavelength (micron)" updatevars: attempt to change the type of "line" ("integer") to "real". Ignoring. Reading file 'readdata.f' (format:fix,strict) Reading file 'radex.inc' (format:fix) Line #25 in readdata.f:" integer ilev,jlev ! to loop over energy levels" updatevars: could not crack entity declaration "jlev!". Ignoring. Line #26 in readdata.f:" integer iline ! to loop over lines" updatevars: could not crack entity declaration "iline!". Ignoring. Line #27 in readdata.f:" integer ipart,jpart ! to loop over collision partners" updatevars: no name pattern found for entity='!'. Skipping. Line #28 in readdata.f:" integer itemp ! to loop over collision temperatures" updatevars: could not crack entity declaration "itemp!". Ignoring. Line #29 in readdata.f:" integer icoll ! to loop over collisional transitions" updatevars: could not crack entity declaration "icoll!". Ignoring. Line #31 in readdata.f:" integer dummy ! to skip part of the file" updatevars: could not crack entity declaration "dummy!". Ignoring. Line #34 in readdata.f:" integer id(maxpart) ! to identify collision partners" updatevars: could not crack entity declaration "id(maxpart)!". Ignoring. Line #40 in readdata.f:" real8 temp(maxtemp) ! collision temperatures" updatevars: could not crack entity declaration "temp(maxtemp)!". Ignoring. Line #40 in readdata.f:" real8 temp(maxtemp) ! collision temperatures" updatevars: attempt to change the type of "collision" ("integer") to "real". Ignoring. Line #40 in readdata.f:" real8 temp(maxtemp) ! collision temperatures" updatevars: attempt to change the type of "temperatures" ("integer") to "real". Ignoring. Line #43 in readdata.f:" character120 collref ! text about source of collisional data" updatevars: no name pattern found for entity='!'. Skipping. Line #43 in readdata.f:" character120 collref ! text about source of collisional data" updatevars: attempt to change the type of "of" ("integer") to "character". Ignoring. updatevars:of: attempt to change empty charselector to {'': '120'}. Ignoring. Line #43 in readdata.f:" character120 collref ! text about source of collisional data" updatevars: attempt to change the type of "collisional" ("integer") to "character". Ignoring. updatevars:collisional: attempt to change empty charselector to {'': '120'}. Ignoring. Post-processing... Block: radex analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: backrad analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: galbr analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: splcoeff Block: splintrp Block: ludcmp Block: lubksb Block: sgeir Block: r1mach Block: sasum Block: scopy Block: sdsdot Block: sgefa Block: isamax Block: saxpy Block: sscal Block: sgesl Block: sdot Block: xermsg Block: j4save Block: xercnt Block: xerhlt Block: xerprn Block: i1mach Block: xgetua Block: xersve analyzevars: character array "character8 libtab(10)" is considered as "character libtab(10,8)"; "intent(c)" is forced. analyzevars: character array "character8 subtab(10)" is considered as "character subtab(10,8)"; "intent(c)" is forced. analyzevars: character array "character20 mestab(10)" is considered as "character mestab(10,20)"; "intent(c)" is forced. Block: fdump Block: matrix analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: escprob analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: getinputs analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: defaults analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Block: length Block: output analyzevars: character array "character6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. /Users/maple/opt/anaconda3/lib/python3.9/site-packages/numpy/f2py/symbolic.py:1508: ExprWarning: fromstring: treating 'k km' as symbol (original=k km/s) ewarn( /Users/maple/opt/anaconda3/lib/python3.9/site-packages/numpy/f2py/symbolic.py:1508: ExprWarning: fromstring: treating 'cm^2' as symbol (original=erg/s/cm^2) ewarn( Block: readdata analyzevars: character array "character*6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced. Post-processing (stage 2)... Saving signatures to file "./radex.pyf" Running f2py with fcompiler=gfortran, f77exec=, include_path=-I/Users/maple/pyradex/Radex/src, linker_path= extra args = --f77flags="-fno-automatic" --fcompiler=gfortran -I/Users/maple/pyradex/Radex/src Current directory = /Users/maple/pyradex/Radex/src Unknown vendor: "gfortran" running build running config_cc INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src INFO: build_src INFO: building extension "radex" sources INFO: f2py options: [] INFO: f2py:> /var/folders/_r/f61_17t15kqdnys0zjnnz9kh0000gn/T/tmpvknv2lxz/src.macosx-10.9-x86_64-3.9/radexmodule.c creating /var/folders/_r/f61_17t15kqdnys0zjnnz9kh0000gn/T/tmpvknv2lxz/src.macosx-10.9-x86_64-3.9 Reading fortran codes... Reading file '/var/folders/_r/f61_17t15kqdnys0zjnnz9kh0000gn/T/tmp9hxxah8q.f' (format:fix,strict)

Done running f2py in /Users/maple/pyradex/Radex/src. r2=1 Unknown vendor: "gfortran" running build running config_cc INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src INFO: build_src INFO: building extension "radex" sources INFO: f2py options: [] INFO: f2py:> /var/folders/_r/f61_17t15kqdnys0zjnnz9kh0000gn/T/tmpe0th5gsm/src.macosx-10.9-x86_64-3.9/radexmodule.c creating /var/folders/_r/f61_17t15kqdnys0zjnnz9kh0000gn/T/tmpe0th5gsm/src.macosx-10.9-x86_64-3.9 Reading fortran codes... Reading file '/var/folders/_r/f61_17t15kqdnys0zjnnz9kh0000gn/T/tmpqc8iimzt.f' (format:fix,strict)

Traceback (most recent call last): File "/Users/maple/pyradex/setup.py", line 120, in setup(name='pyradex', File "/Users/maple/opt/anaconda3/lib/python3.9/distutils/core.py", line 148, in setup dist.run_commands() File "/Users/maple/opt/anaconda3/lib/python3.9/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/Users/maple/opt/anaconda3/lib/python3.9/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Users/maple/pyradex/setup.py", line 44, in run install_radex.install_radex() File "/Users/maple/pyradex/install_radex.py", line 25, in install_radex compile_radex() File "/Users/maple/pyradex/install_radex.py", line 192, in compile_radex raise SystemError(f"f2py failed with error {r2}\n" SystemError: f2py failed with error 1 Try running the command:

cd Radex/src/ f2py -c -m radex --f77flags="-fno-automatic" --fcompiler=gfortran -I/Users/maple/pyradex/Radex/src .f cd - mv Radex/src/so pyradex/radex/

XFengwei commented 1 year ago

It seems there is something wrong with f2py.compile in the command line

r2 = f2py.compile(source="merged_source.f", modulename='radex', verbose=True,

full_output=False,

                  extra_args=extra_args,)
keflavich commented 1 year ago

Agreed, this is where the problem happens. I haven't been able to figure out why, though. There is a difference between the behavior of f2py.compile and the shell command line f2py that I haven't figured out.

keflavich commented 2 months ago

I'm keeping this open as I still think there should be a way to fix

r2 = f2py.compile(source="merged_source.f", modulename='radex',
verbose=True,
# full_output=False,
extra_args=extra_args,)

but I haven't found it yet.