ChatSpatial uses a tiered dependency system designed for maximum compatibility and user control. This guide explains how to install ChatSpatial with the right level of dependencies for your needs.
# Minimal installation (recommended for most users)
pip install -e .
# Advanced features (deep learning, deconvolution)
pip install -e ".[advanced]"
# All features (experimental, requires R)
pip install -e ".[experimental]"Compatible with Python 3.8-3.12
This provides essential spatial transcriptomics analysis capabilities:
- Data loading and preprocessing
- Basic visualization (matplotlib, seaborn)
- Clustering (Leiden, k-means)
- Dimensionality reduction (PCA, UMAP)
- Spatial analysis (Squidpy integration)
- MCP server functionality
pip install -e .
# OR
pip install -r requirements-minimal.txtWhat you get:
- ✅ Load spatial data (10X Visium, Slide-seq, etc.)
- ✅ Quality control and filtering
- ✅ Clustering and UMAP embedding
- ✅ Basic spatial statistics
- ✅ Standard visualizations
- ✅ MCP server for AI integration
Compatible with Python 3.8-3.11 (deep learning limitations)
Adds cutting-edge spatial analysis methods:
- Deep learning deconvolution (Cell2location)
- Advanced integration methods
- RNA velocity analysis
- Enhanced visualizations
pip install -e ".[advanced]"
# OR
pip install -r requirements-advanced.txtAdditional features:
- ✅ Cell2location spatial deconvolution
- ✅ scvi-tools ecosystem (scANVI, DestVI)
- ✅ RNA velocity with scVelo
- ✅ Advanced trajectory analysis (CellRank)
- ✅ Batch integration (Harmony, BBKNN, Scanorama)
- ✅ Spatial variable gene detection
- ✅ Interactive visualizations (Plotly)
Compatible with Python 3.8-3.11 (R interface limitations)
Cutting-edge and experimental features:
- R-based methods (RCTD deconvolution)
- High-performance computing
- Emerging spatial methods
pip install -e ".[experimental]"
# OR
pip install -r requirements-experimental.txtExperimental features:
- ✅ RCTD deconvolution (requires R)
- ✅ High-performance linear algebra (PETSc/SLEPc)
- ✅ Emerging spatial frameworks
⚠️ May have compatibility issues
| Feature | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 | Python 3.12 |
|---|---|---|---|---|---|
| Minimal | ✅ | ✅ | ✅ | ✅ | ✅ |
| Advanced | ✅ | ✅ | ✅ | ✅ | |
| Experimental | ✅ | ✅ | ✅ | ❌³ |
¹ Some deep learning dependencies may lag Python 3.12 support
² R interface (rpy2) has limited Python 3.11 support
³ Most experimental features not yet compatible with Python 3.12
ChatSpatial automatically detects available dependencies and gracefully degrades functionality:
# This will work regardless of which dependencies are installed
from chatspatial.utils.dependency_manager import get_available_methods
# Check what deconvolution methods are available
deconv_methods = {
"cell2location": ["cell2location", "torch"],
"rctd": ["rpy2"],
"destvi": ["scvi-tools", "torch"]
}
available = get_available_methods(deconv_methods)
print(f"Available: {available}")Problem: Some legacy tools require TensorFlow 1.x, which is incompatible with modern Python.
Solution: ChatSpatial no longer supports TensorFlow 1.x. Use PyTorch-based alternatives:
- Instead of STAGATE → Use SpaGCN
- Instead of old scVI → Use scvi-tools 1.0+
Problem: Different tools require different PyTorch versions.
Solution: ChatSpatial standardizes on PyTorch 2.x:
pip install torch>=2.0.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpuFor GPU support:
pip install torch>=2.0.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118Problem: RCTD requires R installation and rpy2.
Solution: Install R first, then Python interface:
# macOS
brew install r
# Ubuntu/Debian
sudo apt install r-base r-base-dev
# Then install Python interface
pip install rpy2>=3.4.0Problem: Deep learning models need proper GPU setup.
Solution: Ensure CUDA compatibility:
# Check CUDA version
nvidia-smi
# Install compatible PyTorch
pip install torch>=2.0.0 --index-url https://download.pytorch.org/whl/cu118# Test dependency detection
python test_dependencies.py
# Test specific installation tier
python test_dependencies.py --level minimal
python test_dependencies.py --level advanced
python test_dependencies.py --level experimental
# Verbose output for debugging
python test_dependencies.py --verboseIf upgrading from an older ChatSpatial installation:
-
Uninstall old version:
pip uninstall chatspatial
-
Clean pip cache:
pip cache purge
-
Install new version:
pip install -e ".[advanced]" -
Test installation:
python test_dependencies.py
pip install -e ".[advanced]"# Install PyTorch with CUDA support first
pip install torch>=2.0.0 --index-url https://download.pytorch.org/whl/cu118
# Then install ChatSpatial
pip install -e ".[advanced]"For reproducible environments:
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Install ChatSpatial
COPY . /app/chatspatial
WORKDIR /app/chatspatial
RUN pip install -e ".[advanced]"
# Test installation
RUN python test_dependencies.py --level advancedfrom chatspatial.utils.dependency_manager import dependency_manager
dependency_manager.print_dependency_report()from chatspatial.utils.dependency_manager import get_available_methods
# What deconvolution methods can I use?
deconv_deps = {
"cell2location": ["cell2location", "torch"],
"rctd": ["rpy2"],
"destvi": ["scvi-tools", "torch"]
}
print("Available:", get_available_methods(deconv_deps))pip install --force-reinstall --no-cache-dir -e ".[advanced]"- Check installation:
python test_dependencies.py --verbose - View dependency report: Run the dependency manager as shown above
- Open an issue: Include the output of the dependency test
- Join discussions: ChatSpatial community forums
The tiered installation system ensures you get maximum functionality while maintaining compatibility with your specific environment and Python version.