afeinstein20 / eleanor

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

eleanor's tensorflow incompatibility with python 3.8 #188

Open rachelbf opened 4 years ago

rachelbf commented 4 years ago

I recently updated to python 3.8 (via conda) since a few of the other packages I have to use had major "unfixable" bugs with python 3.7. I was not able to install eleanor due to a tensorflow issue. Can eleanor be updated to work with tensorflow 2.2? It seems like Python 3.8 support requires tensorflow 2.2 or higher (https://www.tensorflow.org/install/pip). This update would also make it easier to simultaneously work with both stella and eleanor since they currently use different versions of tensorflow.

pip install eleanor gives me this: Screen Shot 2020-09-01 at 14 09 07

benmontet commented 4 years ago

Yes, see also #126. The workflow that we've used was removed in tensorflow2.0, meaning that tensorflow<2 is required at the moment. You have a few options!

1) You can create a separate coda environment for each project (this is good practice anyway!) so the different versions do not clash with each other, then just call whichever one is most relevant at the time. 2) As long as you're not making psf light curves, tensorflow isn't needed so you can just toss that dependency and everything else will work fine 3) Some of us at online.tess.science will be brainstorming ways to do better psf modeling, which likely means leaving tensorflow behind. We want something at least as fast as the current setup, which I think will ultimately mean using jax. The more people which contribute to these efforts the faster and easier it will be for everyone!

warrickball commented 4 years ago

I came to report basically the same issue (pip install failure on Python 3.8) so I hope it's not poor etiquette to bump this.

benmontet commented 4 years ago

No definitely not poor etiquette, it's good to see what's important to multiple users so bumps are appreciated!

We've slowly been getting closer to removing the tensorflow dependency, which has been due to my own slowness.

The only place tf is used is in the psf modeling routines, so if you are okay not using those you can remove tensorflow from the setup.py and it should work fine in all other ways---the module is intentionally only imported when that routine is called so everything else can work without tensorflow. Otherwise stay tuned, we should have an updated version without tensorflow (it's a little slower, but doesn't require deprecated versions of a package so that's a wash) in the intermediate rather than the far future.

hposborn commented 4 years ago

I may have found a hack for this:

sudo python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

I think this is CPU only, but somehow it avoids pip and installs direct from the source at the google api, and doesn't complain!

martindevora commented 3 years ago

No definitely not poor etiquette, it's good to see what's important to multiple users so bumps are appreciated!

We've slowly been getting closer to removing the tensorflow dependency, which has been due to my own slowness.

The only place tf is used is in the psf modeling routines, so if you are okay not using those you can remove tensorflow from the setup.py and it should work fine in all other ways---the module is intentionally only imported when that routine is called so everything else can work without tensorflow. Otherwise stay tuned, we should have an updated version without tensorflow (it's a little slower, but doesn't require deprecated versions of a package so that's a wash) in the intermediate rather than the far future.

I tried this. Howeveer, 'vaneska' is already a dependency that will try to bring tensorflow too, and therefore I'm still finding a failure.

benmontet commented 3 years ago

I tried this. Howeveer, 'vaneska' is already a dependency that will try to bring tensorflow too, and therefore I'm still finding a failure.

Thanks for pointing this out! We don't use vaneska any more, it was still in setup.py as a legacy dependency that we forgot to remove when we removed that dependency. I've removed it from setup.py, and you can do the same or pull the latest github version and then the same advice as above should work the way I expected it to originally.

GijsMulders commented 3 years ago

bump

Any updates on removing or updating the tensorflow dependency?

The new Apple M1 chips don't support tensorflow, and the hacks to make it work are only for TensorFlow 2.x

benmontet commented 3 years ago

Check out the psf-rewrite branch and see if that works for you! It's still under testing but should have the base features you're expecting. We'd be happy to hear of any immediate good or bad effects of trying that out for your PSF modeling needs.

I'm surprised tensorflow doesn't work at all! Especially since we're explicitly not using any GPU capabilities here, it's all on the CPU. There must be some strange behind the scenes decisions involved in making that a thing.

GijsMulders commented 3 years ago

Excellent, I'll take a look at that and see if I can get the psf modeling to work again.

GijsMulders commented 3 years ago

No luck, the psf-rewritebranch still has the tensorflow 1.4 dependency. Or do you mean this branch may work with tensorflow 2.x?

benmontet commented 3 years ago

Ah sorry, I pointed y'all into the wrong place. I thought we had merged it into that branch but it's sitting as an outstanding pull request at this point. Try here: https://github.com/afeinstein20/eleanor/tree/af112eb5e5fbe354dbf4e535f30ae0971b7572fb

This is not fully vetted and still under active development, so passing along cases where it explicitly works well/does not work well is useful!

CCBeard commented 3 years ago

I would also like to bump this, if that's okay!

I'll try a few of the workaround suggested here, but a version that doesn't require tensorflow would be ideal for me, though I still am using PSFs in my code. I'm trying to create a script that utilizes many packages together (lightkurve, exoplanet, etc), and I want to fold eleanor into this, so right now the separate conda environment isn't the best solution for me.

I might also suggest some kind of warning message when installing eleanor on python 3.8? When I do so it installs eleanor 0.2.7, which I assume is the newest version that didn't use tensorflow? It was not immediately obvious to me (and I assume other people) that my python version/tensorflow was the problem here.

doccosmos commented 2 years ago

eleanor 2.0.4 is available but still installing it on python 3.8 or 3.9 reverts to 0.2.7. Please can this be bumped it to a high priority issue.

benmontet commented 2 years ago

I have removed tensorflow (and torch) from the setup.py file so it will install and run the latest version correctly* on python 3.8 or 3.9, rather than reverting to 0.2.7 as there is no tf1.x for the newest version and that has been a requirement for all versions >0.2.7. tensorflow is only imported inside of the PSF functions so if you don't care about making a psf-based light curve you are good to go with python 3.8 or python 3.9.

Note this is only true for the github version, but will flow through to the pypi version at the next version update. For right now you should download the latest version from github to get it to work.

*Of course the PSF modeling routines will not work as you will either have a version of tensorflow that doesn't have the needed utilities or if you do not have tensorflow at all. If the PSF modeling routines are critical to you then I recommend working within a python3.7 environment!

mkunimoto commented 2 years ago

The above solution (installing the github version and avoiding PSF modelling) appears to no longer work. It looks like the tensorflow imports were put back 11 days ago, so eleanor doesn't work for some Mac users.