{"id":24617,"library":"spatialdata","title":"SpatialData","description":"SpatialData is a Python library for storing and processing spatial omics data. It defines an in-memory format using xarray and Zarr for efficient out-of-core operations, supporting multi-modal (transcripts, images, shapes, points, tables) spatial datasets. Version 0.7.2 requires Python >=3.11. Releases are frequent (monthly).","status":"active","version":"0.7.2","language":"python","source_language":"en","source_url":"https://github.com/scverse/spatialdata.git","tags":["spatial-omics","zarr","xarray","bioinformatics","scverse","out-of-core"],"install":[{"cmd":"pip install spatialdata","lang":"bash","label":"Install from PyPI"},{"cmd":"pip install 'spatialdata[extra]'","lang":"bash","label":"Install with extra (e.g., napari visualization)"}],"dependencies":[{"reason":"Required for chunked, compressed array storage.","package":"zarr","optional":true},{"reason":"Required for labeled multi-dimensional arrays.","package":"xarray","optional":true},{"reason":"Required for table (annotation) support.","package":"anndata","optional":true},{"reason":"Optional but recommended for out-of-core/lazy computations.","package":"dask","optional":true}],"imports":[{"note":"","wrong":"","symbol":"SpatialData","correct":"from spatialdata import SpatialData"},{"note":"In older versions (<0.5) the import path was different. Currently read_zarr is exposed at the top level.","wrong":"from spatialdata.io import read_zarr","symbol":"read_zarr","correct":"from spatialdata import read_zarr"},{"note":"I/O functions are in spatialdata.io submodule.","wrong":"","symbol":"read_visium","correct":"from spatialdata.io import read_visium"}],"quickstart":{"code":"from spatialdata import SpatialData, read_zarr\nsdata = read_zarr('path/to/data.zarr')\nprint(sdata)  # inspect elements","lang":"python","description":"Load an existing SpatialData Zarr dataset from disk and display its structure."},"warnings":[{"fix":"Use dictionary-style key access: sdata['table'] instead of sdata.table.","message":"From version 0.7.0, the SpatialData class no longer inherits from dict. Access elements via sdata['table'] instead of sdata.tables or sdata['points'] instead of sdata.points. This breaks code using attribute access.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Use sdata['polygons'] for polygons and sdata['raster'] for images, or check sdata._gen_elements().","message":"In 0.6.0, rename of 'shapes' to 'polygons' and 'images' to 'raster' may break old code. Check element types.","severity":"breaking","affected_versions":">=0.6.0, <0.7.0"},{"fix":"Replace `coordinates` with `spatial_element_type` in read_visium calls.","message":"The `read_visium` function's parameter `coordinates` is deprecated in favor of `spatial_element_type`. Use `spatial_element_type='image'` etc.","severity":"deprecated","affected_versions":">=0.5.5"},{"fix":"When writing, use `sdata.write('path.zarr', overwrite=True)` to fully replace the store.","message":"When writing a SpatialData object to Zarr, only elements that are explicitly added are saved. Deleting an element from the in-memory object does not remove it from the Zarr store; you must use `overwrite=True` or remove the element from the store manually.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use sdata['table'] instead of sdata.table.","cause":"Trying to access elements via attribute (e.g., sdata.tables) in version >=0.7.0 where dict-style access is required.","error":"AttributeError: 'SpatialData' object has no attribute 'tables'"},{"fix":"Change import to 'from spatialdata import read_zarr'.","cause":"In spatialdata >=0.5, read_zarr moved to top-level from spatialdata.io.","error":"ImportError: cannot import name 'read_zarr' from 'spatialdata.io'"},{"fix":"Check available keys with print(sdata) or list(sdata._gen_elements()).","cause":"Trying to access an element that doesn't exist in the SpatialData object.","error":"KeyError: 'Could not find element with key ...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}