Installation¶
Before You Start¶
SLEAP-NN uses uv for installation and environment management. If you're coming from conda/pip, this section explains why.
Why uv?
GPU dependencies are complex. PyTorch requires matching CUDA versions, platform-specific wheels, and careful index configuration. Traditional pip/conda installs often result in CPU-only PyTorch or version conflicts.
uv solves this with the --torch-backend flag:
auto– Detects your GPU and installs the right PyTorchcu130/cu128– Explicit CUDA versionscpu– CPU-only (smaller install)
One command, correct GPU support. No manual index URLs or environment debugging.
uv version requirement
The --torch-backend flag for uv tool install requires uv 0.9.20+. Run uv self update if you encounter errors.
Can I still use pip/conda?
Yes. See the pip installation section below. You'll need to manually configure PyTorch index URLs.
Install SLEAP-NN¶
Step 1: Install uv
Step 2: Install sleap-nn
Python 3.14 not supported
If you don't have Python installed, uv will automatically download the latest version (Python 3.14), which is not yet supported. Add --python 3.13 to specify a compatible version:
This auto-detects your GPU and installs the correct PyTorch build. You can also specify a backend explicitly:
# Explicit CUDA 13.0
uv tool install sleap-nn --torch-backend cu130
# CPU-only (smaller install)
uv tool install sleap-nn --torch-backend cpu
Step 3: Verify
Step 1: Install uv
Step 2: Install sleap-nn
Python 3.14 not supported
If you don't have Python installed, uv will automatically download the latest version (Python 3.14), which is not yet supported. Add --python 3.13 to specify a compatible version:
Apple Silicon
PyTorch uses Metal Performance Shaders (MPS) for GPU acceleration on M1/M2/M3 Macs. No additional configuration needed.
Step 3: Verify
Step 1: Install uv
Step 2: Install sleap-nn
Python 3.14 not supported
If you don't have Python installed, uv will automatically download the latest version (Python 3.14), which is not yet supported. Add --python 3.13 to specify a compatible version:
Step 3: Verify
Updating¶
Note
This preserves the torch backend from your original installation. If you need to change the torch backend, use the reinstall option.
When to use --reinstall
Use this when you've updated CUDA drivers, changed GPUs, or have import errors.
Pre-release Versions¶
Install alpha/beta releases to test new features:
Install a specific pre-release:
Alternative Methods¶
uvx (No Install)¶
Run sleap-nn without permanent installation. Each command creates a temporary environment.
# Train
uvx --from sleap-nn --torch-backend auto sleap-nn train --config config.yaml
# Inference
uvx --from sleap-nn --torch-backend auto sleap-nn predict -i video.mp4 -m models/
Always latest
uvx uses the latest version each run. Great for testing or one-off tasks.
pip¶
Use pip when working within conda/mamba environments.
Create environment:
Install with GPU support:
Note
PyTorch wheels on PyPI include CUDA support on Linux and Windows. This is the simplest option and works for most users.
Other CUDA versions
You can install any CUDA version supported by PyTorch by changing the index URL. Replace cu128 with your desired version (e.g., cu124, cu121, cu118). See PyTorch Get Started for available versions.
Verify:
From Source¶
For development and contributing.
Step 1: Clone repository
Step 2: Install uv (if needed)
Step 3: Install in development mode
gpu is a default dependency group, so a plain uv sync installs the
CUDA 13.0 build on Windows/Linux x86-64 (and the Apple-MPS build on macOS)
automatically, and uv run keeps it. A GPU is not required — the CUDA wheel
also runs on CPU.
Escape hatch: CPU-only wheel or a specific CUDA version
Drop the default group with --no-group gpu and add an extra:
| Command | Backend |
|---|---|
uv sync --no-group gpu --extra cpu |
smaller CPU-only wheel (also Linux aarch64) |
uv sync --no-group gpu --extra torch-cuda128 |
CUDA 12.8 |
uv sync --no-group gpu --extra torch-cuda118 |
CUDA 11.8 |
The gpu / torch-cuda130 extras (uv sync --extra gpu) resolve to the same
cu130 wheel as the default group, so they don't need --no-group gpu. On
Windows the CUDA runtime (incl. cuDNN) ships inside the torch wheel; on Linux
nvidia-cudnn-cu13 is a separate dependency.
Step 4: Run commands
See Contributing for development guidelines.
System Requirements¶
| Requirement | Minimum | Recommended |
|---|---|---|
| Python | 3.11 | 3.13 |
| RAM | 8 GB | 16+ GB |
Apple Silicon
M1/M2/M3 Macs are fully supported via Metal Performance Shaders (MPS).
Python 3.14
Not yet supported. Use --python 3.13 with uv commands.
Troubleshooting¶
Command not found after install
Restart your terminal or source your shell config:
Verify the tool is installed:
CUDA not detected
-
Check NVIDIA drivers:
-
Check sleap-nn detects CUDA:
-
Reinstall with explicit CUDA version:
Import errors or missing modules
Reinstall sleap-nn:
Wrong Python version
Specify the Python version explicitly:
uv version too old
The --torch-backend flag requires uv 0.9.20+.
Next Steps¶
-
Quick Start
Train your first model in 5 minutes.
-
Your First Model
Complete walkthrough from data to predictions.