spatialdata requires Python version >= 3.9 to run and the installation time requires a few minutes on a standard desktop computer.
spatialdata by running::
pip install spatialdata
Visualization and IO#
The SpatialData ecosystem is designed to work with the following packages:
spatialdataIO for common spatial omics technologies.
spatialdata-plot: Static plotting library for
napari-spatialdata: napari plugin for
They can be installed with:
pip install "spatialdata[extra]"
To use the
PyTorch dataloader in
torch needs to be installed. This can be done with:
pip install "spatialdata[torch]"
Installation on a M1/M2 (Apple Silicon) Mac#
The framework supports the Apple Silicon architecture, but
napari-spatialdata cannot be installed with
PyQt5 leads to an installation error.
pip install "spatialdata[extra]" will not work (as it installs
The solution is to pre-install
conda (which will install
PyQt5 correctly), and then install
napari-spatialdata without the option
This is what is done in the following commands, which perform a correct installation on a M1/M2 Mac.
mamba create -n my_env python==3.10 -y conda activate my_env mamba install -c conda-forge napari -y pip install spatialdata spatialdata-io spatialdata-plot napari-spatialdata
spatialdata from GitHub, run:
pip install git+https://github.com/scverse/spatialdata
Alternative you can clone the repository (or a fork of it if you are contributing) and do an editable install with:
pip install -e .
This is the reccommended way to install the package in case in which you want to contribute to the code. In this case, to subsequently update the package you can use
A note on editable install#
If you perform an editable install of
spatialdata and then install
napari-spatialdata, they may automatically override the installation of
spatialdata with the version from PyPI.
To check if this happened you can run
python -c "import spatialdata; print(spatialdata.__path__)"
if you get a path that contains
site-packages, then your editable installation has been overridden and you need to reinstall the package by rerunning
pip install -e . in the cloned