dfm / python-fsps

Python bindings to Charlie Conroy's Flexible Stellar Population Synthesis (FSPS) Fortran code
https://python-fsps.readthedocs.io
MIT License
66 stars 38 forks source link

installation assertion error #100

Closed dnarayanan closed 6 years ago

dnarayanan commented 6 years ago

Hey All,

I'm trying a fresh install of python-fsps on a cluster where I've had it working for some time. This is the latest git hash of both fsps and python-fsps using python2.7.

[desika.narayanan@login4 python-fsps]$ module list

Currently Loaded Modules:
  1) git/2.14.1   2) gcc/5.2.0
[desika.narayanan@login4 python-fsps]$ which f95
/apps/compilers/gcc/5.2.0/bin/f95

and fsps was compiled with:

F90FLAGS = -O3 -march=native -cpp -fPIC

where I (think?) fsps is installed correctly?

[desika.narayanan@login4 src]$ ./simple.exe
 SPS_SETUP ERROR: zin GT nz          20          12

if I try to install python-fsps out of the box, I get an error on line 89 of setup.py:

[desika.narayanan@login4 python-fsps]$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 89, in <module>
    from fsps import __version__  # NOQA
ImportError: No module named fsps

since that line doesn't seem consequential (I think?), if I comment out lines 89 and 101 in setup.py, I can move the error forward to:

[desika.narayanan@login4 python-fsps]$ python setup.py install
running install
running bdist_egg
running egg_info
writing fsps.egg-info/PKG-INFO
writing top-level names to fsps.egg-info/top_level.txt
writing dependency_links to fsps.egg-info/dependency_links.txt
package init file 'fsps/__init__.py' not found (or not a regular file)
reading manifest file 'fsps.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'fsps/fsps.f90'
warning: no files found matching 'fsps/data/filter_keys.txt'
writing manifest file 'fsps.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
Running f2py on ['fsps.f90'] with flags ['-m', '_fsps', '-h', 'fsps.pyf', '--overwrite-signature']
IOError: [Errno 2] No such file or directory: 'fsps.f90'. Skipping file "fsps.f90".
Reading fortran codes...
Post-processing...
Post-processing (stage 2)...
Saving signatures to file "./fsps.pyf"
Running f2py on ['/home/desika.narayanan/fsps/src/csp_gen.o', '/home/desika.narayanan/fsps/src/ssp_gen.o', '/home/desika.narayanan/fsps/src/smoothspec.o', '/home/desika.narayanan/fsps/src/tsum.o', '/home/desika.narayanan/fsps/src/get_lumdist.o', '/home/desika.narayanan/fsps/src/pz_convol.o', '/home/desika.narayanan/fsps/src/linterparr.o', '/home/desika.narayanan/fsps/src/write_isochrone.o', '/home/desika.narayanan/fsps/src/spec_bin.o', '/home/desika.narayanan/fsps/src/sps_vars.o', '/home/desika.narayanan/fsps/src/sfh_weight.o', '/home/desika.narayanan/fsps/src/sbf.o', '/home/desika.narayanan/fsps/src/add_bs.o', '/home/desika.narayanan/fsps/src/imf_weight.o', '/home/desika.narayanan/fsps/src/mod_hb.o', '/home/desika.narayanan/fsps/src/add_nebular.o', '/home/desika.narayanan/fsps/src/getspec.o', '/home/desika.narayanan/fsps/src/linterp.o', '/home/desika.narayanan/fsps/src/setup_tabular_sfh.o', '/home/desika.narayanan/fsps/src/attn_curve.o', '/home/desika.narayanan/fsps/src/sps_setup.o', '/home/desika.narayanan/fsps/src/getindx.o', '/home/desika.narayanan/fsps/src/add_agb_dust.o', '/home/desika.narayanan/fsps/src/compsp.o', '/home/desika.narayanan/fsps/src/imf.o', '/home/desika.narayanan/fsps/src/funcint.o', '/home/desika.narayanan/fsps/src/vacairconv.o', '/home/desika.narayanan/fsps/src/sfhinfo.o', '/home/desika.narayanan/fsps/src/getmags.o', '/home/desika.narayanan/fsps/src/agn_dust.o', '/home/desika.narayanan/fsps/src/sps_utils.o', '/home/desika.narayanan/fsps/src/igm_absorb.o', '/home/desika.narayanan/fsps/src/add_dust.o', '/home/desika.narayanan/fsps/src/mod_gb.o', '/home/desika.narayanan/fsps/src/get_tuniv.o', '/home/desika.narayanan/fsps/src/intsfwght.o', '/home/desika.narayanan/fsps/src/sfhstat.o', '/home/desika.narayanan/fsps/src/add_remnants.o', '/home/desika.narayanan/fsps/src/ztinterp.o', '/home/desika.narayanan/fsps/src/sfhlimit.o', '/home/desika.narayanan/fsps/src/locate.o', 'fsps.f90', 'fsps.pyf'] with flags ['-c', '-I/home/desika.narayanan/fsps/src', '--f90flags=-cpp', '--f90flags=-fPIC']
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules _winreg, win32api or win32con are installed.
Traceback (most recent call last):
  File "setup.py", line 123, in <module>
    "Programming Language :: Python",
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/command/install_lib.py", line 111, in build
    self.run_command('build_ext')
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 63, in run
    invoke_f2py(fns, flags, wd='fsps')
  File "setup.py", line 27, in invoke_f2py
    main()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/numpy/f2py/f2py2e.py", line 648, in main
    run_compile()
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/numpy/f2py/f2py2e.py", line 622, in run_compile
    ext = Extension(**ext_args)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/numpy/distutils/extension.py", line 54, in __init__
    export_symbols=export_symbols)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/site-packages/setuptools/extension.py", line 39, in __init__
    _Extension.__init__(self, name, sources, *args, **kw)
  File "/home/desika.narayanan/miniconda2/lib/python2.7/distutils/extension.py", line 106, in __init__
    assert type(name) is StringType, "'name' must be a string"
AssertionError: 'name' must be a string
[desika.narayanan@login4 python-fsps]$

Reading through the previous issues, this smells possibly of an f2py issue, or a numpy issue, though I can't seem to figure out what that might be -- has anyone seen an issue like this before?

(just to be sure:


In [1]: import numpy

In [2]: numpy.version.version
Out[2]: '1.14.5'
dnarayanan commented 6 years ago

update:

i had in my notes that the last time i had python-fsps installed was on hash

[desika.narayanan@dev1 python-fsps]$ git rev-parse HEAD
85958a61264c9f03aedc69371931b0521bfcefc5

I tried this hash out, and it installed

bd-j commented 6 years ago

It's strange that 85958a6126 works but not the most recent hash. The only change to relevant files was the tabular SFH with metallicity option, and no call signatures or anything else important was changed, and the build tests passed (though with numpy 1.11).

When using the older hash did you still have to comment out the

from fsps import __version__

line in setup.py? This seems like somehow the build logic has gotten borked. I don't know too much about that stuff, any idea what might be the issue @dfm?

bd-j commented 6 years ago

oh wait, this line in your install log seems important:

Running f2py on ['fsps.f90'] with flags ['-m', '_fsps', '-h', 'fsps.pyf', '--overwrite-signature']
IOError: [Errno 2] No such file or directory: 'fsps.f90'. Skipping file "fsps.f90".

I don't see anything like that when I run setup.py install. fsps.f90 is kind of important!

dnarayanan commented 6 years ago

huh that's weird! i clobbered the directory that wasn't working, and now can't reproduce the problem. sigh...oh well. i'll close for now, and reopen if i end up in the same boat downstream. thanks for the help!