afeinstein20 / eleanor

A tool for light curve extraction from the TESS FFIs.
MIT License
92 stars 39 forks source link

Can't find eleanor.Update #246

Closed trmrsh closed 2 years ago

trmrsh commented 2 years ago

Sorry, this seems horribly basic (my first time with eleanor). I installed it with pip, then ran into issues with sectors not being ready, saw "eleanor.Update" and though I would try it, but it doesn't seem to exist for me:

======================================================= In [1]: import eleanor

In [2]: eleanor.Update(sector=40)

AttributeError Traceback (most recent call last)

in ----> 1 eleanor.Update(sector=40) AttributeError: module 'eleanor' has no attribute 'Update' ====================================================== Apologies in advance for the waste of time if I have missed something very obvious
afeinstein20 commented 2 years ago

Hi! What version of eleanor do you have on your machine? You can see this by printing eleanor.__version__

trmrsh commented 2 years ago

yes, it looks incredibly old --- 0.2.7 -- but I only ran "pip install" for the first time a few hours ago I will try to force an upgrade

trmrsh commented 2 years ago

Right, just did that, it had messages about using "cached eleanor-2.0.3.tar.gz" etc, but in the end, I still have 0.2.7 -- is this a problem with my python version (3.9)?

trmrsh commented 2 years ago

it's strange; when I run pip install, I can see it backtracking the versions. Here is an excerpt; I have never seen behaviour like this. By the end, it has worked its way back to 0.2.7 !

pip uninstall eleanor Found existing installation: eleanor 0.2.7 Uninstalling eleanor-0.2.7: Would remove: /.local/lib/python3.9/site-packages/eleanor-0.2.7.dist-info/ /.local/lib/python3.9/site-packages/eleanor/ Proceed (y/n)? y Successfully uninstalled eleanor-0.2.7 fedora:HST> pip install eleanor --user Collecting eleanor Using cached eleanor-2.0.4.tar.gz (6.7 MB) Requirement already satisfied: photutils>=0.7 in /.local/lib/python3.9/site-packages (from eleanor) (1.3.0) Requirement already satisfied: tqdm in /.local/lib/python3.9/site-packages (from eleanor) (4.63.0) Requirement already satisfied: lightkurve>=1.9.0 in /.local/lib/python3.9/site-packages (from eleanor) (2.1.0) Requirement already satisfied: astropy>=3.2.3 in /.local/lib/python3.9/site-packages (from eleanor) (5.0.2) Requirement already satisfied: astroquery in /.local/lib/python3.9/site-packages (from eleanor) (0.4.5) Requirement already satisfied: pandas in /.local/lib/python3.9/site-packages (from eleanor) (1.4.1) Requirement already satisfied: setuptools>=41.0.0 in/.local/lib/python3.9/site-packages (from eleanor) (60.10.0) Collecting torch Using cached torch-1.11.0-cp39-cp39-manylinux1_x86_64.whl (750.6 MB) Collecting eleanor Using cached eleanor-2.0.3.tar.gz (6.7 MB) Using cached eleanor-2.0.2.tar.gz (6.7 MB) Using cached eleanor-2.0.1.tar.gz (6.7 MB) Using cached eleanor-2.0.0.tar.gz (6.7 MB) Using cached eleanor-1.0.5.tar.gz (6.1 MB) Using cached eleanor-1.0.4.tar.gz (45 kB) Using cached eleanor-1.0.3.tar.gz (44 kB) Using cached eleanor-1.0.2.tar.gz (44 kB) Using cached eleanor-1.0.1.tar.gz (44 kB) Requirement already satisfied: mplcursors in /.local/lib/python3.9/site-packages (from eleanor) (0.5.1) Requirement already satisfied: bokeh in /.local/lib/python3.9/site-packages (from eleanor) (2.4.2) Requirement already satisfied: fitsio in /.local/lib/python3.9/site-packages (from eleanor) (1.1.7) Using cached eleanor-1.0.0.tar.gz (37 kB) Using cached eleanor-0.2.10.tar.gz (37 kB) Requirement already satisfied: muchbettermoments in /.local/lib/python3.9/site-packages (from eleanor) (1.0.0) Using cached eleanor-0.2.9.tar.gz (37 kB) Using cached eleanor-0.2.8.tar.gz (37 kB) Using cached eleanor-0.2.7-py2.py3-none-any.whl Requirement already satisfied: vaneska in /.local/lib/python3.9/site-packages (from eleanor) (0.0.dev0) Requirement already satisfied: tensorflow in /.local/lib/python3.9/site-packages (from eleanor) (2.8.0)

etc

trmrsh commented 2 years ago

sorry for spam-level info, but I think it might be something to do with tensorflow. See below. I tried to get around it with --ignore-requires-python but that didn't help. I don't think I need tensorflow for what I want to do, although I could be wrong:

pip install eleanor==2.0.4 --user Collecting eleanor==2.0.4 Using cached eleanor-2.0.4.tar.gz (6.7 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: photutils>=0.7 in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (1.3.0) Requirement already satisfied: tqdm in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (4.63.0) Requirement already satisfied: lightkurve>=1.9.0 in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (2.1.0) Requirement already satisfied: astropy>=3.2.3 in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (5.0.2) Requirement already satisfied: astroquery in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (0.4.5) Requirement already satisfied: pandas in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (1.4.1) Requirement already satisfied: setuptools>=41.0.0 in ./.local/lib/python3.9/site-packages (from eleanor==2.0.4) (60.10.0) Collecting torch Using cached torch-1.11.0-cp39-cp39-manylinux1_x86_64.whl (750.6 MB) ERROR: Could not find a version that satisfies the requirement tensorflow<2.0.0 (from eleanor) (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.8.0rc0, 2.8.0rc1, 2.8.0) ERROR: No matching distribution found for tensorflow<2.0.0

benmontet commented 2 years ago

This is wild, I've also never seen this behavior before, where it rolls back to an old version! Thanks for sending over the full log, that is useful.

I agree this is a tensorflow issue. The problem is a combination of a few things all hitting at once. First, we use tensorflow for some clever strategies it uses in optimisation that makes the PSF modeling very fast. That was great for a while, but they removed the specific functionality we use in the upgrade to tensorflow2.0, so we are forcing versions <2. Unfortunately, then python3.9 is new enough to where they never released a tf1.x version, there are only 2.x versions, which is why it can't find a suitable tensorflow version and rolls back to a very early version of eleanor before that requirement was added.

There are two easy-ish workarounds. First: tensorflow is only ever used in the PSF modeling, so if you never intend to use PSF models, just aperture photometry to make light curves, you don't need it. We've put all the import statements in "safe" places so that it only imports tensorflow when the specific functions that use it are being called. You can run pip install --no-dependencies eleanor which will install it without any dependencies, and assuming you have all the other dependencies (you probably do) you're good to go. Alternatively, you could clone the github version and before you run setup.py, pop into that file and remove tensorflow from the install_requires list and then everything else should install the way you expect it to.

The second potential workaround: if you do want the PSF modeling toolkit, you can create an environment (in conda or similar) using a slightly older version of python, and it should all install just fine into there, and you should be able to use that environment without any problems. I use 3.7.x without any problems, and any version <=3.7.13 should be fine.

Once you have the eleanor2.x versions up and running, eleanor.Update() should do exactly what you are looking for if you're looking to make a light curve for a recent sector if it doesn't work straight out of the box, and you're calling it in just the right way.

trmrsh commented 2 years ago

Ah! --no-dependies! Thank you so much; don't know why I didn't find that when I went looking. Thank you for you help. The tensorflow issue sounds annoying; I hope you find a permanent work around. Thank you for your efforts on eleanor; will ref appropriate paper if & when! Tom