Installation
Requirements
- Python >= 3.9
- Gurobi optimizer (requires license - free for academics)
Basic Installation
Clone the repository and install dependencies:
Or install dependencies directly:
Gurobi License Setup
SAME requires Gurobi for optimization. Academic users can obtain a free license.
Option 1: Web License (Recommended)
- Create an account at gurobi.com
- Request an academic license
- Get your Web License Service (WLS) credentials
- Create
src/.gurobienvfile:
Option 2: Environment Variables
Alternatively, set environment variables:
export GUROBI_WLSACCESSID=your_access_id
export GUROBI_WLSSECRET=your_secret
export GUROBI_LICENSEID=your_license_id
Option 3: Local License
For local or cluster installations, follow Gurobi's documentation to install and activate a local license.
Optional Dependencies
For alpha shape filtering (recommended for better boundary detection):
For Jupyter notebook support:
Verify Installation
from src import run_same, init_optim_params
# Check version
import src
print(f"SAME version: {src.__version__}")
# Verify Gurobi
import gurobipy as gp
env = gp.Env()
print("Gurobi initialized successfully")
Troubleshooting
Gurobi License Issues
If you see "No Gurobi license found":
- Verify your
.gurobienvfile exists insrc/ - Check credentials are correct
- Ensure you have network access (for WLS licenses)
- Try setting environment variables directly
Memory Issues
For large datasets (>10,000 cells), use metacells and lazy constraints:
from src import greedy_triangle_collapse, init_optim_params
# Create metacells to reduce problem size
mc_aligned, _ = greedy_triangle_collapse(aligned_df, max_metacell_size=3)
# Use lazy constraints for memory efficiency
optim = init_optim_params(lazy_constraints=True)
Import Errors
If imports fail, ensure you're in the SAME directory or have it in your Python path: