creare-com / podpac

Pipeline for Observational Data Processing Analysis and Collaboration
https://podpac.org
Apache License 2.0
45 stars 6 forks source link

failure in executing node.eval to work with terrain data tutorial #511

Closed monahmomeni closed 1 year ago

monahmomeni commented 1 year ago

Description I have been following the example notebook for PODPAC library. However, the simplest node.eval(coord) statement fails. Steps to Reproduce

from podpac.datalib.terraintiles import TerrainTiles
from podpac import Coordinates, clinspace

# create terrain tiles node
node = TerrainTiles(tile_format='geotiff', zoom=8)

# create coordinates to get tiles
c = Coordinates([clinspace(40, 43, 1000), clinspace(-76, -72, 1000)], dims=['lat', 'lon'])

# evaluate node
o = node.eval(c)

Expected Behavior Based on the tutorial, I expect this to work without error and returns the terrain attributes for the given coordinates.

Observed Behavior It throws the following traceback error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-e718b03558a3> in <module>
----> 1 node.eval(c)

/opt/conda/lib/python3.7/site-packages/podpac/core/compositor/compositor.py in eval(self, coordinates, **kwargs)
    244 
    245         # note: super().eval (not self._eval)
--> 246         output = super().eval(super_coordinates, **kwargs)
    247 
    248         if settings["DEBUG"]:

/opt/conda/lib/python3.7/site-packages/podpac/core/node.py in eval(self, coordinates, **kwargs)
    294             self._from_cache = True
    295         else:
--> 296             data = self._eval(coordinates, **kwargs)
    297             if self.cache_output:
    298                 self.put_cache(data, item, cache_coordinates)

/opt/conda/lib/python3.7/site-packages/podpac/core/interpolation/interpolation.py in _eval(self, coordinates, output, _selector)
     39             force_eval=True,
     40             cache_ctrl=CacheCtrl([]),
---> 41             style=self.style,
     42         )
     43         node._set_interpolation()

/opt/conda/lib/python3.7/site-packages/podpac/core/node.py in __init__(self, **kwargs)
    208 
    209             # Call traitlets constructor
--> 210             super(Node, self).__init__(**tkwargs)
    211 
    212         self._traits_initialized_guard = True

/opt/conda/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback)
    117         if type is None:
    118             try:
--> 119                 next(self.gen)
    120             except StopIteration:
    121                 return False

/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py in hold_trait_notifications(self)
   1495                 self._cross_validation_lock = False
   1496                 # Restore method retrieval from class
-> 1497                 del self.notify_change
   1498 
   1499                 # trigger delayed notifications

AttributeError: notify_change

Additional Notes I also posted a question on stackoverflow a while ago. Haven't got any answer and not sure how to fix this. https://stackoverflow.com/questions/76903824/failure-on-evaluating-the-nodes-in-podpac-library

mpu-creare commented 1 year ago

Could you please confirm what version of podpac you're using?

import podpac
podpac.__version__
mpu-creare commented 1 year ago

While we're at it... could you also please give me a sense of your environment? From the command line:

pip freeze
monahmomeni commented 1 year ago

Could you please confirm what version of podpac you're using?

import podpac
podpac.__version__

Thanks, sorry I missed that, it is '3.2.0' and I have installed with pip (using [all] option).

monahmomeni commented 1 year ago

While we're at it... could you also please give me a sense of your environment? From the command line:

pip freeze
awscli @ file:///home/conda/feedstock_root/build_artifacts/awscli_1692835832471/work
boltons @ file:///home/conda/feedstock_root/build_artifacts/boltons_1677499911949/work
botocore @ file:///home/conda/feedstock_root/build_artifacts/botocore_1692830113630/work
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1687884021435/work
brotlipy @ file:///home/conda/feedstock_root/build_artifacts/brotlipy_1666764672617/work
certifi==2023.7.22
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1671179360775/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1688813409104/work
click @ file:///home/conda/feedstock_root/build_artifacts/click_1692311806742/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1602866480661/work
conda==4.11.0
conda-package-handling @ file:///home/conda/feedstock_root/build_artifacts/conda-package-handling_1666837452491/work
cryptography @ file:///home/conda/feedstock_root/build_artifacts/cryptography-split_1672672393437/work
docutils @ file:///home/conda/feedstock_root/build_artifacts/docutils_1610127764788/work
dparse @ file:///home/conda/feedstock_root/build_artifacts/dparse_1687803182432/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1663625384323/work
jmespath @ file:///home/conda/feedstock_root/build_artifacts/jmespath_1655568249366/work
jsonpatch @ file:///home/conda/feedstock_root/build_artifacts/jsonpatch_1632759296524/work
jsonpointer==2.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1681337016113/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1687776318736/work
pyasn1==0.4.8
pycosat @ file:///home/conda/feedstock_root/build_artifacts/pycosat_1666836642684/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1685514481738/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1692737146376/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1684774241324/work
rsa @ file:///home/conda/feedstock_root/build_artifacts/rsa_1614171254180/work
ruamel-yaml-conda @ file:///home/conda/feedstock_root/build_artifacts/ruamel_yaml_1666819784739/work
ruamel.yaml @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml_1686993888032/work
ruamel.yaml.clib @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml.clib_1670412733608/work
s3transfer @ file:///home/conda/feedstock_root/build_artifacts/s3transfer_1692149178344/work
safety @ file:///home/conda/feedstock_root/build_artifacts/safety_1670491074076/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
supervisor==4.2.5
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1657485559105/work
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1691671248568/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1678635778344/work

sure, this is in sagemaker aws environment.

mpu-creare commented 1 year ago

Ah, that does look like a conda environment. I think i also need a

conda list

TLDR; My guess is it's a package versioning issue.

monahmomeni commented 1 year ago

Ah, that does look like a conda environment. I think i also need a

conda list

TLDR; My guess is it's a package versioning issue.

image
mpu-creare commented 1 year ago

Looks like there's an issue with one of the newer versions of traitlets... try:

pip install traitlets==5.6

or the equivalent conda command... conda install pip=5.6 ??? (not sure, haven't used conda in a while)

monahmomeni commented 1 year ago

is there a way I can force the podpac package use traitlets version 5.6? I mean I installed 5.6 in my terminal (and can do in Jupyter notebook), but once I re-install the podpac, the requirements is traitlets >=4.3 and will be upgraded to latest šŸ¤” Right now it is traitlets 5.9.0

wait.. I am not so familiar but maybe a temporary fix could be:

pip install traitlets==5.6 && pip install podpac --no-cache-dir --no-build-isolation

and a permanent fix needs to tag this version in the requirements of podpac šŸ˜Š

This actually worked thanks a lot for your insights and quick replies šŸ™ šŸŽ‰

mpu-creare commented 1 year ago

Great! Glad that worked! You can also do a pip install podpac --no-deps to make sure it doesn't try to upgrade traitlets.

I need to look into why traitlets's newest version is giving us trouble. We're not exactly pushing the bleeding edge of traitlets capabilities, so the fix might be over on their end. I will take a bit of trouble to figure out what the root cause is.

Feel free to post questions here -- I don't monitor StackOverflow at all for podpac questions.