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

Error during pyradex installation #41

Closed
isabelmontoyaa opened this issue Apr 24, 2023 · 10 comments
Closed

Error during pyradex installation #41

isabelmontoyaa opened this issue Apr 24, 2023 · 10 comments

Comments

@isabelmontoyaa
Copy link

Hello,

I have been trying to install pyradex with no success.
I have a MacBook Pro, macOS Ventura 13.3.1

$ python -c "import sys, astropy, numpy; print(sys.version); print(numpy.version,astropy.version)"
3.10.11 (main, Apr 20 2023, 13:59:00) [Clang 14.0.6 ]
1.22.3 5.1

$ gfortran --version
GNU Fortran (MacPorts gcc12 12.2.0_2+stdlib_flag) 12.2.0

By reading Issues #39 and #40, I have tried the following (with no success):

  1. Inside the folder Radex/src I ran:
    f2py -c -m radex --f77flags=-fno-automatic --fcompiler=gfortran -I/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib *.f

  2. cd ../.. and then ran:
    FFLAGS='-arch i686 -arch x86_64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2' LDFLAGS='-arch i686 -arch x86_64 -undefined dynamic_lookup -bundle' python setup.py install_radex

And here is the prompt:

/opt/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/dist.py:529: UserWarning: Normalizing '0.4.2dev' to '0.4.2.dev0'
warnings.warn(tmpl.format(**locals()))
Downloading RADEX
Download succeeded, or at least didn't obviously fail.
Extracting RADEX source from file /Users/isabelmontoyaarroyave/.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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" character
10 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" real
8 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:" character
120 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:" character
120 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 "character
6 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 "character
6 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 "character
8 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 "character
6 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 "character
6 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 "character
6 qnum(2999)" is considered as "character qnum(2999,6)"; "intent(c)" is forced.
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/numpy/f2py/symbolic.py:1508: ExprWarning: fromstring: treating 'k km' as symbol (original=k km/s)
ewarn(
/opt/anaconda3/envs/py310/lib/python3.10/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/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/Radex/src, linker_path=
extra args = --f77flags="-fno-automatic" --fcompiler=gfortran -I/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/Radex/src
Current directory = /Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/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/4v/z0sz8nfx5k98v5qvmvljj4fh0000gq/T/tmpeyj33w4e/src.macosx-10.9-x86_64-3.10/radexmodule.c
creating /var/folders/4v/z0sz8nfx5k98v5qvmvljj4fh0000gq/T/tmpeyj33w4e/src.macosx-10.9-x86_64-3.10
Reading fortran codes...
Reading file '/var/folders/4v/z0sz8nfx5k98v5qvmvljj4fh0000gq/T/tmpafbwyq4p.f' (format:fix,strict)

Done running f2py in /Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/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/4v/z0sz8nfx5k98v5qvmvljj4fh0000gq/T/tmpgnaxhn36/src.macosx-10.9-x86_64-3.10/radexmodule.c
creating /var/folders/4v/z0sz8nfx5k98v5qvmvljj4fh0000gq/T/tmpgnaxhn36/src.macosx-10.9-x86_64-3.10
Reading fortran codes...
Reading file '/var/folders/4v/z0sz8nfx5k98v5qvmvljj4fh0000gq/T/tmpojz6n_sr.f' (format:fix,strict)

Traceback (most recent call last):
File "/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/setup.py", line 120, in
setup(name='pyradex',
File "/opt/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/opt/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/opt/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/opt/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
super().run_command(command)
File "/opt/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/setup.py", line 44, in run
install_radex.install_radex()
File "/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/install_radex.py", line 25, in install_radex
compile_radex()
File "/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/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/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/Radex/src *.f
cd -
mv Radex/src/*so pyradex/radex/

See also Github issues 39 and 40

I would appreciate any help!
Thanks!

@keflavich
Copy link
Owner

This is a really unhelpful error message from fortran, unfortunately! It doesn't give any clues about what's happening.

You are using a different version of python & fortran than others. I have a few suggestions for how you might search for a fix/workaround, but no guarantee this will work:

  1. try installing a conda environment and building pyradex in that environment
  2. see if you can compile the fortran code at all, not using f2py. This may help us figure out if fortran is the problem or if f2py is. However... I tried this with the gfortran installed on my machine and it failed immediately in a way that I think is not helpful, so I'm not sure this will work:
$ gfortran -I/Users/adam/repos/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -fno-automatic main.f
gfortran: warning: couldn’t understand kern.osversion ‘21.6.0
ld: warning: building for macOS 10.4 is deprecated
ld: library not found for -lgcc_s.10.4
collect2: error: ld returned 1 exit status

There may be missing libraries or flags you need to get pyradex to install, but we'll have to dig to figure out what.

@isabelmontoyaa
Copy link
Author

Hi,

So I tried compiling gfortran alone, and this is what I get:

$ gfortran -I/Users/isabel/Documents/PhD_Oslo/personalPC/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib main.f
Undefined symbols for architecture x86_64:
  "_backrad_", referenced from:
      _MAIN__ in ccsWQYpM.o
  "_getinputs_", referenced from:
      _MAIN__ in ccsWQYpM.o
  "_matrix_", referenced from:
      _MAIN__ in ccsWQYpM.o
  "_output_", referenced from:
      _MAIN__ in ccsWQYpM.o
  "_readdata_", referenced from:
      _MAIN__ in ccsWQYpM.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

@keflavich
Copy link
Owner

What architecture is your system? Are you on an M1 or M2, or an older mac?

@isabelmontoyaa
Copy link
Author

I am on an older Mac (2019), intel core i7

@keflavich
Copy link
Owner

OK, weird, those are better-behaved than the new ARM ones. I'm not sure what to do about this. My best guess is that you have some incomplete libraries, but I don't know why.

...maybe try FFLAGS='-arch i686 -arch x86_64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2' LDFLAGS='-arch i686 -arch x86_64 -undefined dynamic_lookup -bundle gfortran -I/Users/isabel/Documents/PhD_Oslo/personalPC/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib main.f
i.e., set all the flags before compiling, and see if that works?

Otherwise, you should try a conda installation

@isabelmontoyaa
Copy link
Author

I tried that and still no luck.

$ FFLAGS='-arch i686 -arch x86_64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2' LDFLAGS='-arch i686 -arch x86_64 -undefined dynamic_lookup -bundle' gfortran -I/Users/isabelmontoyaarroyave/Documents/PhD_Oslo/PhD/Research_tools/radex_emcee-master/pyradex/Radex/src -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib main.f
Undefined symbols for architecture x86_64:
  "_backrad_", referenced from:
      _MAIN__ in ccZGTqx2.o
  "_getinputs_", referenced from:
      _MAIN__ in ccZGTqx2.o
  "_matrix_", referenced from:
      _MAIN__ in ccZGTqx2.o
  "_output_", referenced from:
      _MAIN__ in ccZGTqx2.o
  "_readdata_", referenced from:
      _MAIN__ in ccZGTqx2.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Do you mean a conda installation of gfortran?

@keflavich
Copy link
Owner

Maybe. I think on mac, conda defaults to using the built-in compilers. But it might install additional libraries?

@isabelmontoyaa
Copy link
Author

Okay, after losing (what felt like) years of my life, the issue was apparently a non-compatible version of the linker (ld).
When checking which ld it was using, it returned:

$ which -a ld
/opt/anaconda3/bin/ld
/opt/local/bin/ld
/usr/bin/ld

And after changing my $PATH variable to set /opt/local/bin/ld as the first one, it worked.

I'm not sure why this happens, maybe it's a problem of the Anaconda version.

@keflavich
Copy link
Owner

Wow, good work finding that - and I sympathize, I have spent similar ages debugging this sort of junk. I'm glad you solved it!

@keflavich
Copy link
Owner

I'm closing this as solved, but thanks again @isabelmontoyaa for tracking down the issue... "Okay, after losing (what felt like) years of my life" is every time I do anything with f2py. (but it's still better than running radex on the command line)

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