Installation

InstanSeg is published on PyPI as instanseg-torch and supports Python 3.9 and later.

Install from PyPI

For a minimal installation, with everything needed to run inference:

$ pip install instanseg-torch

InstanSeg also provides optional extras:

io

Extra image readers (bioio, tiffslide, slideio) and GeoJSON export.

full

Everything in io, plus the dependencies needed to train models, export them to the BioImage Model Zoo, and run the example notebooks.

$ pip install "instanseg-torch[io]"
$ pip install "instanseg-torch[full]"

Tip

We recommend installing into a fresh virtual environment, for example with mamba or uv:

$ mamba create -n instanseg-env python=3.11
$ mamba activate instanseg-env

GPU support

InstanSeg runs on the CPU, on NVIDIA GPUs (CUDA) and on Apple silicon (MPS). The device is chosen automatically, or can be set with the device argument of InstanSeg.

To use an NVIDIA GPU, install a CUDA-enabled build of PyTorch by following the PyTorch installation guide. Then check that PyTorch can see the GPU:

$ python -c "import torch; print('CUDA available:', torch.cuda.is_available())"

Install from source

To train your own models or contribute to InstanSeg, clone the repository and install it in editable mode:

$ git clone https://github.com/instanseg/instanseg.git
$ cd instanseg
$ pip install -e ".[full]"

To also install the test dependencies:

$ pip install -e ".[full,test]"

Check the installation

$ python -c "from instanseg import InstanSeg; print('InstanSeg installed successfully!')"

Next, head to the Quickstart.