h3-py icon indicating copy to clipboard operation
h3-py copied to clipboard

[BUG] Can't run on Colab

Open JorgeMiguelGomes opened this issue 1 year ago • 1 comments

Something happened that H3 no longer run on Google Colab.

  1. H3 was running perfectly
  2. When trying to install now the following error happens:
[/usr/local/lib/python3.10/dist-packages/h3pandas/h3pandas.py](https://localhost:8080/#) in <module>
      9 import geopandas as gpd
     10 
---> 11 from h3 import h3
     12 from pandas.core.frame import DataFrame
     13 from geopandas.geodataframe import GeoDataFrame

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

JorgeMiguelGomes avatar Oct 17 '24 10:10 JorgeMiguelGomes

The H3-py 4.0 beta was finally released (actually as 4.1 to also include those features from the C code) so if you didn't pin to 3.7 in collab you got the major version bump which introduced breaking changes in the API.

You can see if you can roll back to 3.7 temporarily to get working and then see what you need to change to use the new major version.

One quick note is that you don't have to from h3 import h3 you can just import h3 but most of the APIs have changed between these major versions so that by itself won't be enough to upgrade.

dfellis avatar Oct 17 '24 14:10 dfellis

Thank you so much for you quick reply and solution. Forcing the version worked for us.

JorgeMiguelGomes avatar Oct 22 '24 09:10 JorgeMiguelGomes