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

Cannot import h3 from h3 #33

Open
ioalexei opened this issue Nov 25, 2024 · 3 comments
Open

Cannot import h3 from h3 #33

ioalexei opened this issue Nov 25, 2024 · 3 comments

Comments

@ioalexei
Copy link

ioalexei commented Nov 25, 2024

I've started getting an error importing h3pandas:

import h3pandas 
>>  File "/path/.venv/lib/python3.12/site-packages/h3pandas/h3pandas.py", line 11, in <module>

>>from h3 import h3
>>ImportError: cannot import name 'h3' from 'h3' (/path/.venv/lib/python3.12/site-packages/h3/__init__.py)

Edit:
Python version 3.12.3
h3 4.1.2
h3pandas 0.2.6

@sankalpsharmaa
Copy link

I get the same error

@ajfriend
Copy link

This is because we've updated the API in h3-py in v4. In general, when you're upgrading from v3 to v4, any occurrences of from h3 import h3 can be replaced with import h3.

Just note that most of the function names have changed to align with the renaming that happened in the core library. See the new API here: https://uber.github.io/h3-py/api_quick.html

In the short term, you can pin h3 < 4 to avoid this error.

@ioalexei
Copy link
Author

ioalexei commented Dec 2, 2024

thanks @ajfriend .

adding a pinned dependency of h3 <4 in addition to the entry for h3pandas in my pyproject.toml fixed this for me.

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

3 participants