skyportal / gwemopt

Gravitational-wave Electromagnetic Optimization
GNU General Public License v3.0
19 stars 34 forks source link

Missing __main__ file #149

Closed oconnorb closed 11 months ago

oconnorb commented 11 months ago

In the latest version of the github (this skyportal branch) there is no main file so a git pull breaks the ability to run gwemopt until manually adding the old main file to the correct location. The Usage documentation nots a gwemopt-run, which also does not work at present. The version of gwemopt that can be installed through pip seems fine at present.

mcoughlin commented 11 months ago

gwemopt-run just points to run.py: https://github.com/skyportal/gwemopt/blob/main/pyproject.toml#L59 Can you explain more about the behavior you are seeing?

oconnorb commented 11 months ago

After running "git pull" I tried to run:

python -m gwemopt -t DECam -e S230922g

resulting in the error

/Users/brendan/opt/anaconda3/envs/gwemopt/bin/python: No module named gwemopt.main; ‘gwemopt’ is a package and cannot be directly executed

Due to the lack of the main file.

I then tried gwemopt_run and I received the error:

/Users/brendan/opt/anaconda3/envs/gwemopt/bin/python: No module named gwemopt-run

The fix for me was to add back the old main file and then could run in the default manner.

mcoughlin commented 11 months ago

@oconnorb we removed the gwemopt_run and replaced with gwemopt-run. Does this work for you?

oconnorb commented 11 months ago

Could you clarify exactly the command you want me to try? I was unsuccessful in having gwemopt-run work.

i.e., by replacing "python -m gwemopt ..." with "gwemopt-run ..."

mcoughlin commented 11 months ago

The pyproject.toml makes an executable called gwemopt-run.

oconnorb commented 11 months ago

Gotcha, I see that in the .toml file. Is there a step I am missing to run after "git pull" that would create the executable?

mcoughlin commented 11 months ago

@oconnorb You are using pip install . or similar to build?

oconnorb commented 11 months ago

Ah, no. I had just ran "git pull" in a prior installation as I wanted Tomas's update to the parallelization. In any case, gwemopt is working for me as I just added the main file back in manually so I can still run with "python -m gwemopt". I just wanted to make sure this wasn't an issue that would impact new users, so I guess as long as they install through pip they will be fine. Thanks! :)

mcoughlin commented 11 months ago

Ok I see. So you run setup.py? That is an old style way of doing things that is now being deprecated in general slowly but surely.

oconnorb commented 11 months ago

I'll be sure to use "pip install -e gwemopt" in the future. I made a note of this for next time I update. Igor said he was able to get this to work on his end using that.

mcoughlin commented 11 months ago

Ok great. -e basically sim links the files, but that should do fine for this purpose.