Installation#

Quick install#

scvi-tools can be installed via conda or pip. We recommend installing into a fresh virtual environment to avoid conflicts with other packages and compatibility issues.

For the basic CPU version run:

pip install -U scvi-tools

or

conda install scvi-tools -c conda-forge

Don’t know how to get started with virtual environments or conda/pip? Check out the prerequisites section.

Prerequisites#

Virtual environment#

A virtual environment can be created with either conda or venv. We recommend using a fresh conda environment. We currently support Python 3.10 - 3.13.

For conda, we recommend using the Miniforge or Mamba distribution, which are generally lighter & faster than the official distribution and comes with conda-forge as the default channel (where scvi-tools is hosted).

conda create -n scvi-env python=3.12  # any python 3.10 to 3.13
conda activate scvi-env

For venv, we recommend using uv, which is a high-performance Python package manager and installer written in Rust.

pip install -U uv
uv venv .scvi-env
source .scvi-env/bin/activate  # for macOS and Linux
.scvi-env\Scripts\activate  # for Windows

GPU support with PyTorch and JAX#

scvi-tools depends on PyTorch and JAX for accelerated computing. If you don’t plan on using an accelerated device, we recommend installing scvi-tools directly and letting these dependencies be installed automatically by your package manager of choice.

If you plan on taking advantage of an accelerated device (e.g. Nvidia GPU or Apple Silicon), which is likely, scvi-tools supports it. In order to install scvi-tools with Nvidia GPU CUDA support, for Linux Systems (such as Ubuntu or RedHat) use:

pip install -U scvi-tools[cuda]

And for Apple Silicon metal (MPS) support:

pip install -U scvi-tools[metal]

However, there might be cases where the GPU HW is not supporting the latest installation of PyTorch and Jax. In this case we recommend installing PyTorch and JAX before installing scvi-tools. Please follow the respective installation instructions for PyTorch and JAX compatible with your system and device type.

Optional dependencies#

scvi-tools is installed in its lightest form by default. It has many optional dependencies, which expand its capabilities:

  • autotune - in order to run scvi.autotune

  • hub - in order to use scvi.hub

  • regseq - in order to run scvi.data.add_dna_sequence

  • scanpy - in order to use scanpy

  • file_sharing - for convenient files sharing

  • parallel - for parallelization engine

  • interpretability - for supervised models interpretability

  • dataloaders - for custom dataloaders use

  • tests - in order to be able to perform tests

  • editing - for code editing

  • dev - for development purposes

  • cuda - for linux based OS GPU support

  • metal - for Apple Silicon metal (MPS) support

  • docsbuild - in order to create docs

The easiest way to install these is with pip. In order to install capability X run: pip install scvi-tools[X]

You can install several capabilities together, e.g: To install scvi-tools with scanpy support for GPU on Ubuntu: pip install scvi-tools[cuda,scanpy]

To install all tutorial dependencies:

pip install -U scvi-tools[tutorials]

To install all optional dependencies (e.g. scanpy support, custom dataloaders, autotune, criticism, model hub):

pip install -U scvi-tools[optional]

To install development dependencies, including pre-commit and testing dependencies:

pip install -U scvi-tools[dev]

And to install all capabilites of scvi-tools, simply run:

pip install -U scvi-tools[all]

Docker#

If you plan on running scvi-tools in a containerized environment, we provide various Docker images hosted on GHCR.

R#

scvi-tools can be called from R via Reticulate.

This is only recommended for basic functionality (getting the latent space, normalized expression, differential expression). For more involved analyses with scvi-tools, we highly recommend using it from Python.

The easiest way to install scvi-tools for R is via conda.

  1. Install conda prerequisites.

  2. Install R and reticulate in the conda environment:

    conda install -c conda-forge r-base r-essentials r-reticulate
    
  3. Then in your R code:

    library(reticulate)