scverse / scverse/spatialdata-io

failure to import spatialdata_io

Open
#263 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
103
Forks
65
Avg merge
1h 8m
Merged PRs (30d)
3

Description

Hello, I am running one of the tutorials and I have installed both spatialdata and spatialdata_io packages, but there is an error importing spatialdata_io. Could you help? Thank you very much!

ImportError Traceback (most recent call last)
Cell In[9], line 2
1 import spatialdata as sd
----> 2 from spatialdata_io import xenium
4 import matplotlib.pyplot as plt
5 import seaborn as sns

File /opt/anaconda3/lib/python3.12/site-packages/spatialdata_io/init.py:14
12 from spatialdata_io.readers.visium import visium
13 from spatialdata_io.readers.visium_hd import visium_hd
---> 14 from spatialdata_io.readers.xenium import (
15 xenium,
16 xenium_aligned_image,
17 xenium_explorer_selection,
18 )
20 all = [
21 "curio",
22 "seqfish",
(...)
34 "visium_hd",
35 ]
37 version = version("spatialdata-io")

File /opt/anaconda3/lib/python3.12/site-packages/spatialdata_io/readers/xenium.py:40
32 from spatialdata.models import (
33 Image2DModel,
34 Labels2DModel,
(...)
37 TableModel,
38 )
39 from spatialdata.transformations.transformations import Affine, Identity, Scale
---> 40 from xarray import DataArray, DataTree
42 from spatialdata_io._constants._constants import XeniumKeys
43 from spatialdata_io._docs import inject_docs

ImportError: cannot import name 'DataTree' from 'xarray' (/opt/anaconda3/lib/python3.12/site-packages/xarray/init.py)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with spatialdata_io/readers/xenium.py and the failing from xarray import DataArray, DataTree import shown in the traceback. Check the installed xarray and spatialdata-io versions and the tutorial environment; done means from spatialdata_io import xenium imports successfully with the documented installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.