srodney / sndrizpipe

Image registration, combination and subtraction with astrodrizzle+tweakreg. Aimed at simple processing of supernova imaging from HST.
3 stars 9 forks source link

Issue: can't find '__main__' #8

Closed oconnorb closed 5 years ago

oconnorb commented 5 years ago

Hi,

I am having an issue running sndrizpipe following the installation. I have tried installation using: python setup.py install and python setup.py develop. The error is the same for either method. I have attached a screenshot (below) of the error. As you can see, I am having difficulty finding 'main' in sndrizpipe. I first believed it to be an issue with my python path, which I attempted to fix, but it still cannot find the file to run either inside or outside my astroconda environment.

Thank you, Brendan

sndrizpipe_error

oconnorb commented 5 years ago

Update: I tried this installation again on a different operating system (Mac) and with a fresh installation of astroconda. The same issue of " can't find 'main' " arises. Any help in fixing this issue is greatly appreciated!

srodney commented 5 years ago

@oconnorb - apologies for the delay responding. I haven't been able to reproduce your error locally, but I think the problem is that I did not properly define entry points for command-line scripts in setup.py. I would guess that I (and my students who have mimicked my setup) have skated by on this b/c of some peculiarity of the path setup. The main.py module does exist in the top-level directory, and I have the directory one level up on my PYTHONPATH. So that may be how I can get it to run at the command line without a proper entry point. You can try setting your PYTHONPATH to include /home/brendan instead of /home/brendan/sndrizpipe-master. Even if that works, it's a kludgy workaround at best, so I'll see if I can get setup.py to provide an entry point.

koconnor4 commented 5 years ago

I can't reproduce errors either, but the initial error makes sense as mentioned above the main.py isn't inside /home/brendan/sndrizpipe-master/sndrizpipe

I'm surprised though it didn't work with the pythonpath set to include /home/brendan/sndrizpipe-master ...I thought that would do it.

If the above suggestion to have the the pythonpath include home/brendan rather than /home/brendan/sndrizpipe-master doesn't work either I'd say maybe try and run it not inside the sndrizpipe-master dir, it might be getting confused when it is being run locally there somehow.

Sorry couldn't be more help.

oconnorb commented 5 years ago

Thank you for the great responses! I have tried all of the suggestions, but the same error persists.

I tried with python paths: 1) /home/brendan/sndrizpipe-master 2) /home/brendan/

I ran them in the /home/brendan/sndrizpipe-master folder as well as /home/brendan/ The error when in /home/brendan/ was "python: can't open file 'sndrizpipe': [Errno 2] No such file or directory".

It does seem to me however that in the image I initially posted that when I ran: 1) source activate astroconda 2) export PYTHONPATH=/home/brendan/sndrizpipe-master 3) python sndrizpipe

that it was able to find sndrizpipe and failed due to some permissions error that is probably due to my personal machine. I am not sure though as to why when I run: "sudo python sndrizpipe" that it responds with "can't find main".

srodney commented 5 years ago

OK. I think I've got a fix that uses the entry_points setup as it is intended to.

Please give this a try as follows:

(should not need the full path, and shouldn't need to point to a specific module or subdir)

Let me know if that works.

oconnorb commented 5 years ago

I used: git pull https://github.com/srodney/sndrizpipe.git But it does not seem to have made the stated changes to the folder as after I re-install and try to execute the pipeline using "sndirzpipe -h" I get the response "command not found" and I could not find the runpipe_cmdline.py file you stated above. Is there a different repository you meant for me to git pull from?

srodney commented 5 years ago

Hmm. Not sure why you're not getting the changes. The runpipe_cmdline.py file is in the sndrizpipe/sndrizpipe sub-directory (so, one level down from the top of the repository tree). See here:

https://github.com/srodney/sndrizpipe/blob/master/sndrizpipe/runpipe_cmdline.py

Above, you had "sndirzpipe -h" instead of "sndrizpipe -h" but I presume that was just a typo in your comment, and you had the spelling correct on the command line.

Please do these four commands from the top level of your local version of the git repository and post the results here: git log git status grep -3 runpipe setup.py git remote show origin

oconnorb commented 5 years ago

Hi,

I attempted your previous suggestions again using git clone instead of git pull and it worked, so your suggestions of:

"git pull from this remote repository

use python setup.py install (develop should work too)

use 'unalias' to clear out any aliases you may have defined in your shell profile

execute the pipeline from the command line with

sndrizpipe -h"

were correct and sndrizpipe is now running properly.

Thank you so much for the help, and sorry for the confusion!!

srodney commented 5 years ago

Great. Glad to hear its working for you again.
If you don't mind sharing, I'd be interested to know what you're using sndrizpipe for (as far as I know, there are not many users outside of my students and direct collaborators). Send me an email if you'd like!