COSMIC-PopSynth / COSMIC

COSMIC (Compact Object Synthesis and Monte Carlo Investigation Code)
GNU General Public License v3.0
47 stars 59 forks source link

JSON error when using cosmic-pop #466

Closed XYU1204 closed 3 years ago

XYU1204 commented 3 years ago

I'm running into the following JSON error both on my laptop and on a remote server. Is there a way to get around this? Traceback (most recent call last): File "/verafs/home/xiaoqiyu/.local/bin/cosmic-pop", line 149, in args = parse_commandline() File "/verafs/home/xiaoqiyu/.local/bin/cosmic-pop", line 69, in parse_commandline BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile) File "/verafs/home/xiaoqiyu/.local/lib/python3.8/site-packages/cosmic/utils.py", line 1078, in parse_inifile raise ValueError("inifile supplied does not exist") ValueError: inifile supplied does not exist (cosmic) [xiaoqiyu@r022 cosmic-ini]$ cosmic-pop --final-kstar1 13 14 --final-kstar2 13 14 --inifile tryParams.ini --Nstep 10 --Niter 100 -n 2 Traceback (most recent call last): File "/verafs/home/xiaoqiyu/.local/bin/cosmic-pop", line 149, in args = parse_commandline() File "/verafs/home/xiaoqiyu/.local/bin/cosmic-pop", line 69, in parse_commandline BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile) File "/verafs/home/xiaoqiyu/.local/lib/python3.8/site-packages/cosmic/utils.py", line 1140, in parse_inifile dictionary[section][option] = json.loads(opt) File "/opt/packages/python/3.8.5/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/opt/packages/python/3.8.5/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/packages/python/3.8.5/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

scottcoughlin2014 commented 3 years ago

@XYU1204 Thanks for bringing this issue to our attention. Right off the bat, I am not sure why the Python 3.8 that is released with anaconda is giving this behavior. If I go on a Linux machine and make an anaconda environment before installing cosmic (including and anaconda environment that has a fresh copy of Python 3.8 installed in it, instead of using the system wide Python 3.8), I can confirm that this error/behavior goes away.

conda create -c conda-forge --name cosmic-py38 numpy h5py python=3.8 --yes
source activate cosmic-py38
pip install cosmic-popsynth

and then try the example, it works.

wget https://raw.githubusercontent.com/COSMIC-PopSynth/COSMIC/v3.3.0/examples/Params.ini
module purge all
module load python/anaconda3.6
source activate cosmic-py38
cosmic-pop --final-kstar1 13 14 --final-kstar2 13 14 --inifile Params.ini --Nstep 10 --Niter 100 -n 2
carlrodriguez commented 3 years ago

I tried it on Vera (CMU Cluster) and it seems to work. Thanks!

astrokang commented 3 years ago

-kstar2 13 14 --inifile /Users/admin/Documents/GitHub/COSMIC/examples/Params.ini --Nstep 1000 --Niter 1000000000 -n 2 Traceback (most recent call last): File "/opt/anaconda3/envs/cosmic/bin/cosmic-pop", line 149, in args = parse_commandline() File "/opt/anaconda3/envs/cosmic/bin/cosmic-pop", line 69, in parse_commandline BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile) File "/opt/anaconda3/envs/cosmic/lib/python3.8/site-packages/cosmic/utils.py", line 1140, in parse_inifile dictionary[section][option] = json.loads(opt) File "/opt/anaconda3/envs/cosmic/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/opt/anaconda3/envs/cosmic/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/anaconda3/envs/cosmic/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'm running into the same problem like this in my own laptop(Mac) . How should I call for the cosmic-pop without going on a Linux machine ? Thanks!

astrokang commented 3 years ago

截屏2021-02-07 下午5 03 26

By the way, I don't not know if the problem and the note were related ? I ignored this note because my Mac now is 'macOS Big Sur 11.2' . I don't know if I should follow this note to install that ?

scottcoughlin2014 commented 3 years ago

I now know what this problem is and it is a poorly formatted ini file but the error is super unhelpful we need to fix

scottcoughlin2014 commented 3 years ago

515 fixes this bad error messaging.