afeinstein20 / eleanor

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

error while importing eleanor #270

Open MeArpanGhosh opened 9 months ago

MeArpanGhosh commented 9 months ago

Hi, I installed Eleanor. While importing the module I am facing the following error

Traceback (most recent call last): File "", line 1, in File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/eleanor/init.py", line 5, in from .eleanor import File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/eleanor/eleanor.py", line 3, in from .targetdata import TargetData File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/eleanor/targetdata.py", line 25, in import tensorflow as tf File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow/init.py", line 99, in from tensorflow_core import File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/init.py", line 28, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "", line 1019, in _handle_fromlist File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow/init.py", line 50, in getattr module = self._load() File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow/init.py", line 44, in _load module = _importlib.import_module(self.name) File "/home/arpan/anaconda3/envs/tess/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/python/init.py", line 52, in from tensorflow.core.framework.graph_pb2 import * File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/core/framework/graph_pb2.py", line 16, in from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_nodedefpb2 File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/core/framework/node_def_pb2.py", line 16, in from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attrvaluepb2 File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/core/framework/attr_value_pb2.py", line 16, in from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensorpb2 File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/core/framework/tensor_pb2.py", line 16, in from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resourcehandle__pb2 File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/core/framework/resource_handle_pb2.py", line 16, in from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensorshapepb2 File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/tensorflow_core/core/framework/tensor_shape_pb2.py", line 42, in serialized_options=None, file=DESCRIPTOR), File "/home/arpan/anaconda3/envs/tess/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 561, in new _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

My python version is Python 3.7.16. Please help

mcregogarcia commented 7 months ago

I have a similar case. Has any solution been found for this ?

mcregogarcia commented 7 months ago

I installed from Github instead of pip install and it worked for me.

MeArpanGhosh commented 7 months ago

Hi, Thanks for your suggestion. I have now successfully installed the eleanor module as you mentioned before. However, while I am trying to replicate the quickstart guide ( https://eleanor.readthedocs.io/en/latest/getting_started/tutorial.html ), I am running into following problem :

data = eleanor.TargetData(star, height=15, width=15, bkg_size=31, do_psf=True, regressors='corner')

OSError Traceback (most recent call last)

in ----> 1 data = eleanor.TargetData(star, height=15, width=15, bkg_size=31, do_psf=True, regressors='corner') ~/eleanor/eleanor/targetdata.py in __init__(self, source, height, width, save_postcard, do_pca, do_psf, bkg_size, aperture_mode, cal_cadences, try_load, regressors, language) 187 if source.tc == False: 188 self.post_obj = Postcard(source.postcard, source.postcard_bkg, --> 189 source.postcard_path) 190 else: 191 self.post_obj = Postcard_tesscut(source.cutout) ~/eleanor/eleanor/postcard.py in __init__(self, filename, background, filepath) 56 self.filename = os.path.join(filepath, filename) 57 self.local_path = copy.copy(self.filename) ---> 58 self.hdu = fits.open(self.local_path) 59 self.background2d = fits.open(os.path.join(filepath, background))[1].data 60 ~/anaconda3/envs/tess/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py in fitsopen(name, mode, memmap, save_backup, cache, lazy_load_hdus, ignore_missing_simple, **kwargs) 172 173 return HDUList.fromfile(name, mode, memmap, save_backup, cache, --> 174 lazy_load_hdus, ignore_missing_simple, **kwargs) 175 176 ~/anaconda3/envs/tess/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py in fromfile(cls, fileobj, mode, memmap, save_backup, cache, lazy_load_hdus, ignore_missing_simple, **kwargs) 409 save_backup=save_backup, cache=cache, 410 ignore_missing_simple=ignore_missing_simple, --> 411 lazy_load_hdus=lazy_load_hdus, **kwargs) 412 413 @classmethod ~/anaconda3/envs/tess/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py in _readfrom(cls, fileobj, data, mode, memmap, cache, lazy_load_hdus, ignore_missing_simple, **kwargs) 1088 if hdulist._file.close_on_error: 1089 hdulist._file.close() -> 1090 raise OSError('No SIMPLE card found, this file does not ' 1091 'appear to be a valid FITS file') 1092 OSError: No SIMPLE card found, this file does not appear to be a valid FITS file Are you facing the same issue?