dfm / python-fsps

Python bindings to Charlie Conroy's Flexible Stellar Population Synthesis (FSPS) Fortran code

Home Page:https://python-fsps.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong installation?

BabisDaoutis opened this issue · comments

Hi,

I try to install fsps. I follow the process of (https://dfm.io/python-fsps/current/installation/). Everything is normal during the installation process and I am able to get spectra and emission lines. I try to switch stellar libraries from "MILES" to "BASEL". Even thought it is done successfully, uninstalling and then reinstalling using the relevant flags , when I try to run the python script it returns the following error : ''SPS_SETUP ERROR: wavelength grid cannot be opened''. I tried a clean install (in case something went wrong) but the error persists. I even tried the developer installation. When I run the unit tests (python3 -m nox) I get the following :

result of running: python3 -m nox
nox > Running session tests-3.8
nox > Missing interpreters will error by default on CI systems.
nox > Session tests-3.8 skipped: Python interpreter 3.8 not found.
nox > Running session tests-3.9
nox > Missing interpreters will error by default on CI systems.
nox > Session tests-3.9 skipped: Python interpreter 3.9 not found.
nox > Running session tests-3.10
nox > Creating virtual environment (virtualenv) using python3.10 in .nox/tests-3-10
nox > python -m pip install '.[test]'
nox > python tests/simple.py
success
nox > python -m pytest -n 2 --durations=0 -v tests/tests.py
======================================= test session starts ========================================
platform linux -- Python 3.10.6, pytest-7.2.2, pluggy-1.0.0 -- /home/babis/python-fsps/.nox/tests-3-10/bin/python
cachedir: .pytest_cache
rootdir: /home/babis/python-fsps
plugins: xdist-3.2.1
[gw0] linux Python 3.10.6 cwd: /home/babis/python-fsps
[gw1] linux Python 3.10.6 cwd: /home/babis/python-fsps
[gw0] Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
[gw1] Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
gw0 [15] / gw1 [15]
scheduling tests via LoadScheduling

tests/tests.py::test_imf3
tests/tests.py::test_isochrones
[gw1] [ 6%] PASSED tests/tests.py::test_imf3
tests/tests.py::test_param_checks
[gw1] [ 13%] PASSED tests/tests.py::test_param_checks
tests/tests.py::test_smooth_lsf
[gw1] [ 20%] PASSED tests/tests.py::test_smooth_lsf
tests/tests.py::test_get_mags
[gw0] [ 26%] PASSED tests/tests.py::test_isochrones
tests/tests.py::test_tabular
[gw1] [ 33%] PASSED tests/tests.py::test_get_mags
tests/tests.py::test_ssp
[gw1] [ 40%] PASSED tests/tests.py::test_ssp
tests/tests.py::test_filters
[gw1] [ 46%] PASSED tests/tests.py::test_filters
tests/tests.py::test_csp_dirtiness
[gw1] [ 53%] PASSED tests/tests.py::test_csp_dirtiness
tests/tests.py::test_redshift
[gw1] [ 60%] PASSED tests/tests.py::test_redshift
tests/tests.py::test_nebemlineinspec
[gw1] [ 66%] PASSED tests/tests.py::test_nebemlineinspec
tests/tests.py::test_mformed
[gw1] [ 73%] PASSED tests/tests.py::test_mformed
tests/tests.py::test_light_ages
[gw1] [ 80%] PASSED tests/tests.py::test_light_ages
tests/tests.py::test_smoothspec
[gw1] [ 86%] PASSED tests/tests.py::test_smoothspec
[gw0] [ 93%] PASSED tests/tests.py::test_tabular
tests/tests.py::test_libraries
[gw0] [100%] PASSED tests/tests.py::test_libraries

======================================== slowest durations =========================================
299.37s call tests/tests.py::test_isochrones
255.46s call tests/tests.py::test_tabular
147.31s call tests/tests.py::test_imf3
97.66s call tests/tests.py::test_smooth_lsf
48.77s call tests/tests.py::test_param_checks
48.29s call tests/tests.py::test_get_mags
11.49s setup tests/tests.py::test_isochrones
11.48s setup tests/tests.py::test_imf3
0.24s call tests/tests.py::test_filters
0.16s call tests/tests.py::test_mformed
0.06s call tests/tests.py::test_nebemlineinspec
0.05s call tests/tests.py::test_redshift
0.01s call tests/tests.py::test_smoothspec
0.01s call tests/tests.py::test_light_ages
0.01s teardown tests/tests.py::test_tabular
0.01s call tests/tests.py::test_csp_dirtiness

(29 durations < 0.005s hidden. Use -vv to show these durations.)
================================== 15 passed in 566.75s (0:09:26) ==================================
nox > Session tests-3.10 was successful.
nox > Running session options-3.8
nox > Missing interpreters will error by default on CI systems.
nox > Session options-3.8 skipped: Python interpreter 3.8 not found.
nox > Running session options-3.9
nox > Missing interpreters will error by default on CI systems.
nox > Session options-3.9 skipped: Python interpreter 3.9 not found.
nox > Running session options-3.10
nox > Creating virtual environment (virtualenv) using python3.10 in .nox/options-3-10
nox > python -m pip install '.[test]'
nox > python tests/options.py
SPS_SETUP ERROR: wavelength grid cannot be opened
nox > Session options-3.10 was successful.
nox > Ran multiple sessions:
nox > * tests-3.8: skipped
nox > * tests-3.9: skipped
nox > * tests-3.10: success
nox > * options-3.8: skipped
nox > * options-3.9: skipped
nox > * options-3.10: success


My system is Ubuntu Ubuntu 22.04.2 LTS.

What do you suggest me to do in order to fix this?

I assume this has something to do with a version mismatch between your SPS_HOME installation and the Python bindings, but @bd-j might have more specific ideas!

Agreed, you might try cd $SPS_HOME; git pull and it would be good to know which version of python-fsps you have installed.

Thank you both for your quick replies!

I did cd $SPS_HOME; git pull and it prints "Already up to date". I checked the version and it is 0.4.2.
Also I tried a clean install with

export SPS_HOME="/fsps"
git clone https://github.com/cconroy20/fsps.git $SPS_HOME
python3 -m pip install fsps

Then I try to change stellar libraries to set BASEL

pip uninstall fsps
FFLAGS="-DMILES=0 -DBASEL=1" python3 -m pip install fsps --no-binary fsps

with no problems so far...
But when I run an fsps script I get this again
" SPS_SETUP ERROR: wavelength grid cannot be opened", while if I switch back to MIST everything run smoothly.

UPDATE
I tried to install older versions of fsps with no succes. I even tried to install the final version of fsps to other computers and older versions of Ubuntu with no luck either... and I have the same issue, everything works up until I change from "MILES" to "BASEL". Do you have any suggestions or ideas about what I am doing wrong?

there's a PR on fsps that I think solves this issue (cconroy20/fsps#64), but the python-fsps submodule will have to be updated in python-fsps. Sorry, I'm traveling at the moment so progress has been slow

Ok, no worries! I figured you might be busy so I tried to remove any variables that might causing the problem from my side. As far as the [(https://github.com/cconroy20/fsps/pull/64)] does not seem to do anything, still the same error. By the way, because I see that there has been different was for installation, can you suggest me a "secure" installation procedure (I do this https://dfm.io/python-fsps/current/installation/)? is this what I all need for a clean install? :

export SPS_HOME="/fsps"
git clone https://github.com/cconroy20/fsps.git $SPS_HOME
python3 -m pip install fsps

As far as the cconroy20/fsps#64 does not seem to do anything, still the same error.

These Python bindings are built against a specific commit to the FSPS repository so unless you're installing from this GitHub repo, I don't think that the workflows you've been using would integrate that change. Currently, the SPS_HOME copy of FSPS is only used for data, not for source code.

In order to test that, you should be able to try something like:

python3 -m pip uninstall fsps
FFLAGS="-DMILES=0 -DBASEL=1" python3 -m pip install git+https://github.com/dfm/python-fsps.git

which will reinstall python-fsps from the GitHub version, which does include cconroy20/fsps#64 already.

In terms of clean install: your recommended steps should do the trick (although you may want to uninstall fsps first)!

Hi,

Yes, that works! Thank you very much! I can switch to BASEL now with no issue.

Awesome!

@bd-j — I think we should probably run another release to PyPI in that case. I'm happy to do it if you agree!

There's a couple small changes coming this week then I agree we should push a new version.