scverse / scverse/spatialdata

Can not import the package using jupyter notebook in Visual Studio Code

Open
#1,014 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

I'm running into issues while importing the spatialdata package in visualstudio code software using jupyterlab.


ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import spatialdata, spatialdata_io
2 print("spatialdata version:", spatialdata.version)
3 print("spatialdata-io version:", spatialdata_io.version)

File ~/Projects/xenium5k/.venv/lib/python3.11/site-packages/spatialdata_io/init.py:9
7 from spatialdata_io.readers.dbit import dbit
8 from spatialdata_io.readers.generic import generic, geojson, image
----> 9 from spatialdata_io.readers.macsima import macsima
10 from spatialdata_io.readers.mcmicro import mcmicro
11 from spatialdata_io.readers.merscope import merscope

File ~/Projects/xenium5k/.venv/lib/python3.11/site-packages/spatialdata_io/readers/macsima.py:20
17 from spatialdata._logging import logger
19 from spatialdata_io._constants._enum import ModeEnum
---> 20 from spatialdata_io.readers._utils._utils import (
21 calc_scale_factors,
22 parse_channels,
23 parse_physical_size,
24 )
26 if TYPE_CHECKING:
27 from collections.abc import Mapping

File ~/Projects/xenium5k/.venv/lib/python3.11/site-packages/spatialdata_io/readers/_utils/_utils.py:7
4 from pathlib import Path
5 from typing import TYPE_CHECKING, Any, Union
----> 7 from anndata.io import read_text
8 from h5py import File
9 from ome_types import from_tiff

ModuleNotFoundError: No module named 'anndata.io'

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

Reproduce the import in the Jupyter notebook environment described in the traceback, then inspect spatialdata_io/readers/_utils/_utils.py and its anndata.io import. Confirm the dependency or import issue and verify that importing spatialdata and spatialdata_io completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python, vscode
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.