planetary-computer-sdk-for-python
planetary-computer-sdk-for-python copied to clipboard
ImportError: cannot import name dataclass_transform
Cannot import name dataclass_transform by PyPl installing planetary-computer
What version of Python do you have, and how did you install planetary-computer? I can't reproduce this in a new virtual environment
❯ python3 -m pip install planetary-computer
❯ python3 -c "import planetary_computer"
Are you able to post the full traceback? dataclass_transform isn't a (direct) dependency of planetary computer, but maybe one of the dependencies is pulling it in.
What version of Python do you have, and how did you install planetary-computer? I can't reproduce this in a new virtual environment
❯ python3 -m pip install planetary-computer ❯ python3 -c "import planetary_computer"Are you able to post the full traceback?
dataclass_transformisn't a (direct) dependency of planetary computer, but maybe one of the dependencies is pulling it in.
My Azure Databricks is using 11.2 ML Databricks Runtime. I assume the Python version is 3.7/3.8.
I installed the PyPl planetary_computer package.
Here is the full traceback:
I copied the code form Microsoft Planetary Computer Example Notebook
Can you create a clean virtual environment and try there? I'm wondering if some existing package is incompatible with our dependencies (possibly pydantic is pulling in this dependency, but that should have been fixed in https://github.com/pydantic/pydantic/issues/4423).
The code works in Planetary Computer Hub, but it doesn't work in Azure Databricks.
Here are the Databricks Runtime 11.2 ML Version Libaries
I haven't used Databricks before, so it'll be a while before I can look into this. But I suspect it's nothing particular to this package and would happen any time you try to import pydantic / its dependencies.
I'm guessing it's "just" a matter of getting the package configuration correct.
There is Pydantic 1.9.2 in Databricks Runtime 11.2 ML Version while there is no Pydantic in Databricks Runtime 11.2 Version, but these 2 versions also have the same error (ImportError: cannot import name dataclass_transform) after my testing.
FYI, I've heard that things do work with the Runtime 11.3 version, as long as you restart things after installing planetary-computer.