sdss / target_selection

Code to perform target selection for BHM/MWM using catalogdb
https://sdss-target-selection.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Runtime error immediately after installation on Utah systems #49

Open tdwelly opened 3 years ago

tdwelly commented 3 years ago

Hi José,

calling for help in desperation after having tried everything I could think of to get target_selection up and running on Utah machines.

Problem - I am able to run target_selection (both 'main' and 'bhm_v05_3' branches), installed via git+python setup.py install on my local machine, communicating with the sdssdb via an ssh tunnel to Utah. However, repeating the installation process on the eboss.sdss.org machine, and running a trivial test post installation results in the following runtime error:

(py37) u6023218@eboss:/uufs/chpc.utah.edu/common/home/sdss10/sdss5/target/development/0.5.0$ target_selection --help [ERROR]: Traceback (most recent call last): File "/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/bin/target_selection", line 4, in import('pkg_resources').run_script('sdss-target-selection==0.2.3', 'target_selection') File "/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/pkg_resources/init.py", line 651, in run_script self.require(requires)[0].run_script(script_name, ns) File "/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/pkg_resources/init.py", line 1448, in run_script exec(code, namespace, namespace) File "/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/sdss_target_selection-0.2.3-py3.7.egg/EGG-INFO/scripts/target_selection", line 9, in from target_selection.main import target_selection File "/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/sdss_target_selection-0.2.3-py3.7.egg/target_selection/init.py", line 27, in from .xmatch import XMatchPlanner, XMatchModel # isort:skip File "/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/sdss_target_selection-0.2.3-py3.7.egg/target_selection/xmatch.py", line 33, in from target_selection.utils import (Timer, get_configuration_values, ImportError: cannot import name 'Timer' from 'target_selection.utils' (/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/sdss_target_selection-0.2.3-py3.7.egg/target_selection/utils/init.py)

I have "pip install -U" updated to latest versions, all packages referred to within target_selection/setup.cfg, including sdssdb and sdsstools.

I expect I'm doing something trivially stupid, but cannot for the life of me work out what it is!

Any pointers?

Cheers

Tom

albireox commented 3 years ago

Not so trivial, I cannot immediately know what's wrong. Is your home version also Python 3.7? I tend to use 3.8 or 3.9 so although target_selection is supposed to work with 3.7 I may have inadvertently added something that's 3.8+.

albireox commented 3 years ago

A couple other things for you to try. It seems that in /uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7 you have multiple old versions of sdss-target-selection. Try doing

pip uninstall sdss-target-selection

multiple time and remove all the existing versions, until it tells you it doesn't find any matching package. You can also ls

/uufs/chpc.utah.edu/common/home/u6023218/environments/py37/lib/python3.7/site-packages/

an make sure there are no remaining entries for target_selection or sdss-target-selection and if so remove them manually. Then reinstall. It seems that Python is installing the package as an egg, which is more prone to problems. What I do in those cases normally is to update the packaging tools

pip install -U pip wheel setuptools

and then install the package with

pip install .

instead of python setup.py install.

I've tested this at home with a 3.7 version and seems to work fine.

tdwelly commented 3 years ago

Hi José

Thanks for all of the tips - I hadn't realised that there were quite so many layers of old detritus within my environment.

Unfortunately, after trying what you suggested, plus drastic eradication + reinstallation of any package starting with "sdss*", I arrived at the same error message as before.

Which package is intended to supply the 'Timer' class on: this line of xmatch.py?

I think I'll try a fresh environment next.

For reference - my home machine is running python 3.8.5, but I'm using python 3.7.3 on the Utah systems (as it seems to be the most recent version provided via a module).

tdwelly commented 3 years ago

Curiouser and curiouser

A fresh Python 3.7.3 environment on eboss.sdss.org with minimal package installation results in the same error message as before.

However, a fresh Python 3.8.5 environment on my home machine results in no error messages (as before).

Full sequence is:

/uufs/chpc.utah.edu/sys/installdir/python/3.7.3/bin/python3.7 -m venv ~/environments/py373 . ~/environments/py373/bin/activate pip install -U pip wheel setuptools pip install numpy cd ~/SDSSV/gitwork/target_selection/ git checkout bhm_v05_3 pip install .

By the way, I appear to have broken the main branch of target_selection with a rogue bit of indentation in target_selection.yml Sorry! Fixed in bhm_v05_3 branch (which is what I have been using to run these installation tests).

albireox commented 3 years ago

Mmm, interesting. Timer is provided by target_selection itself, in the utils.py file. Something that you can try is commenting the import of the cross-matching modules by commenting line 27 in __init__.py, since you're only interested on the carton code.

I went to my account in eboss and did the same steps you listed and everything seems to work fine for me, so it may be something in your account configuration, although I cannot honestly think what it could be.