Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Error When Running odc.stac on Colab #164

Open
CristinaMarsh opened this issue Jul 16, 2024 · 2 comments
Open

Import Error When Running odc.stac on Colab #164

CristinaMarsh opened this issue Jul 16, 2024 · 2 comments

Comments

@CristinaMarsh
Copy link

CristinaMarsh commented Jul 16, 2024

Hi there,

I hope this message finds you well. I encountered an issue while trying to use odc.stac in Google Colab. It seems there's an import error related to dask.typing. Below is the code snippet and the full traceback of the error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_12981/1875870462.py in <cell line: 3>()
      1 import geopandas as gpd
      2 import json
----> 3 from odc.stac import stac_load
      4 
      5 # # Define the bounding box for Beijing

2 frames
/usr/local/lib/python3.10/dist-packages/odc/loader/_builder.py in <module>
     30 from dask.base import quote, tokenize
     31 from dask.highlevelgraph import HighLevelGraph
---> 32 from dask.typing import Key
     33 from numpy.typing import DTypeLike
     34 from odc.geo.geobox import GeoBox, GeoBoxBase, GeoboxTiles

ImportError: cannot import name 'Key' from 'dask.typing' (/usr/local/lib/python3.10/dist-packages/dask/typing.py)

It appears that there might be an issue with the compatibility between odc.stac and the current version of dask being used. Any guidance on resolving this issue or updating the package to be compatible with the latest versions of dask would be greatly appreciated.

Thank you very much for your time and assistance!

@Kirill888
Copy link
Member

looks like the real issue is that we started using dask.typing.Key but have not updated minimal bound on dask. This was added to dask with dask/dask#10485

Not sure what version of Dask is in colab, but it's not latest, latest one should have it. You should be able to update dask to a more recent version, or alternatively downgrade odc-stac.

Work item for odc-stac is to figure out oldest version of Dask that has dask.typing.Key available and update dask bounds here:

dask[array]

and also on conda-forge. I don't think we can afford supporting old versions of Dask, error is in packaging and should be fixed there.

@CristinaMarsh
Copy link
Author

looks like the real issue is that we started using dask.typing.Key but have not updated minimal bound on dask. This was added to dask with dask/dask#10485

Not sure what version of Dask is in colab, but it's not latest, latest one should have it. You should be able to update dask to a more recent version, or alternatively downgrade odc-stac.

Work item for odc-stac is to figure out oldest version of Dask that has dask.typing.Key available and update dask bounds here:

dask[array]

and also on conda-forge. I don't think we can afford supporting old versions of Dask, error is in packaging and should be fixed there.

Thank you! Your suggestion to upgrade Dask was spot on! I updated Dask to the latest version (dask-2024.7.0), and it resolved the problem perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants