scverse / spatialdata-plot

Static plotting for spatialdata
BSD 3-Clause "New" or "Revised" License
25 stars 13 forks source link

cannot import name ‘get_table_keys’ with version 0.2.1 #254

Closed Michael-Geuenich closed 2 days ago

Michael-Geuenich commented 2 months ago

I get the following error when trying to import spatialdata_plot with the latest version of spatialdata-plot:

import spatialdata_plot
Traceback (most recent call last):
  File “<stdin>“, line 1, in <module>
  File “/opt/conda/lib/python3.10/site-packages/spatialdata_plot/__init__.py”, line 3, in <module>
    from . import pl, pp
  File “/opt/conda/lib/python3.10/site-packages/spatialdata_plot/pl/__init__.py”, line 1, in <module>
    from .basic import PlotAccessor
  File “/opt/conda/lib/python3.10/site-packages/spatialdata_plot/pl/basic.py”, line 26, in <module>
    from spatialdata_plot.pl.render import (
  File “/opt/conda/lib/python3.10/site-packages/spatialdata_plot/pl/render.py”, line 21, in <module>
    from spatialdata.models import PointsModel, get_table_keys
ImportError: cannot import name ‘get_table_keys’ from ‘spatialdata.models’ (/opt/conda/lib/python3.10/site-packages/spatialdata/models/__init__.py)

This is fixed if I downgrade to version 0.1.0

asmilagswash commented 1 week ago

I'm getting this same error

ile ~/.local/lib/python3.10/site-packages/spatialdata_plot/pl/render.py:21 19 from scanpy._settings import settings as sc_settings 20 from spatialdata._core.data_extent import get_extent ---> 21 from spatialdata.models import PointsModel, get_table_keys 22 from spatialdata.transformations import ( 23 get_transformation, 24 ) 26 from spatialdata_plot._logging import logger

ImportError: cannot import name 'get_table_keys' from 'spatialdata.models' (/home/asmilags/.local/lib/python3.10/site-packages/spatialdata/models/init.py)

LucaMarconato commented 2 days ago

There was a problem in the installation script, where no minimum spatialdata version was required, while get_table_keys has been introduced only from a more recent spatialdata release. I have fixed this now and made a fresh release.

I'll close the issue as it should now be fixed by running pip install spatialdata spatialdata-io spatialdata-plot napari-spatialdata. Feel free to reopen if the problem persists.