Library / SDK
slideflow/slideflow avatar
slideflow/slideflow

Slideflow: A Digital Pathology Deep Learning Library With Two Backends, Two Slide Readers and Licensed Add-ons

Powerful, open-source AI tools for digital pathology.

377 stars68 forksPythonApache-2.0

At a glance

What is it?
Slideflow is an Apache-2.0 Python library for training pathology models on whole-slide images, with PyTorch or TensorFlow, cuCIM or Libvips, and an optional set of non-commercial foundation models. Its environment constraints are tight, and its last tagged release dates from October 2024.
Who is it for?
Slideflow fits pathology researchers who want one library for slide processing, stain normalization, MIL and explainability, and who can manage a CUDA environment. It is not a plug-and-play tool: Python and backend versions are pinned tight, the best foundation models sit behind non-commercial add-ons, and the newest tagged release is 3.0.2 from October 2024.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 52 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 26, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • slideflow/slideflow377 ★ · +1
Star history
Repository2026-09-132026-11-26
slideflow/slideflow376377

1 Stars in the last 74 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

PyTorch and TensorFlow are both supported, and SF_BACKEND picks one

Slideflow supports both PyTorch and TensorFlow and defaults to PyTorch when both are available. You choose the backend with an environment variable:

code
export SF_BACKEND=tensorflow

The stated requirements are PyTorch 1.9 or newer, or TensorFlow 2.5 through 2.11. The repository's requirements.txt installs both stacks together: `tensorflow>=2.7,<2.12`, `torch>=1.9.1`, `tensorflow_probability<0.20`, `tensorflow_datasets<4.9.0` and `protobuf<3.21`, plus packages such as spacy below 3.8, cellpose below 2.2 and `smac==1.4.0`.

The upper bounds are the real constraint. TensorFlow is capped below 2.12 and protobuf below 3.21, so a modern environment with newer versions of those packages will not satisfy Slideflow without adjustment. That ties the library to an older generation of the deep learning stack. If you want current PyTorch features, check what the installer resolves before building a project on it, and expect to create a dedicated environment rather than adding Slideflow to an existing one.

Python is capped below 3.10 when cuCIM is in use, and cupy must match your CUDA

The Python requirement reads 3.7 or newer, with a condition: below 3.10 if you use cuCIM. Because cuCIM is the default slide reader, most users land on the lower range. The pip method installs it with an extra:

code
pip3 install --upgrade setuptools pip wheel
pip3 install slideflow[cucim] cupy-cuda11x

The cupy package name depends on the installed CUDA version, and the README links to CuPy's own install instructions to pick the right one. `cupy` is not required if you use Libvips.

Two consequences follow. A recent Python such as 3.11 is not compatible with the cuCIM route as documented, so you need an older interpreter or the Libvips path. And the `cupy-cuda11x` name in the example targets CUDA 11, so a machine on another CUDA version needs a different package. This is the first place installs fail, and the failure is about environment matching, not about Slideflow itself. Create a clean environment, check your CUDA version, and choose the cupy package to match before running the install.

cuCIM is fast but reads fewer scanner formats than Libvips

By default Slideflow reads whole-slide images with cuCIM. The README calls it much faster than other openslide-based frameworks, but notes that it supports fewer slide scanner formats. Slideflow also ships a Libvips backend, which adds support for `.scn`, `.mrxs`, `.ndpi`, `.vms` and `.vmu` files. You switch with a second environment variable:

code
export SF_SLIDE_BACKEND=libvips

Libvips 8.9 or newer is listed as an optional requirement, as an alternative slide reader. So the fast reader is the default, and the compatible reader is the fallback you set when your scanner's files will not open.

If your slides come from a scanner that writes NDPI or MRXS, cuCIM alone may not open them and the fix is to set the Libvips backend. That choice affects speed. A lab with mixed scanner formats may end up running different backends for different datasets. What a slide is in this context is simply a whole-slide image: a very large scanned file that Slideflow reads, divides into tiles and feeds to a model.

Docker images ship OpenSlide and Libvips with either TensorFlow or PyTorch

For users who would rather skip environment matching, there are pre-configured Docker images. They come with OpenSlide and Libvips and the latest version of either TensorFlow or PyTorch. The TensorFlow image:

code
docker pull jamesdolezal/slideflow:latest-tf
docker run -it --gpus all jamesdolezal/slideflow:latest-tf

The PyTorch image:

code
docker pull jamesdolezal/slideflow:latest-torch
docker run -it --shm-size=2g --gpus all jamesdolezal/slideflow:latest-torch

Note the `--shm-size=2g` flag on the PyTorch run command. It raises shared memory, which PyTorch data loading uses, and leaving it out is a common source of crashes in containers. Both commands pass `--gpus all`, so the container needs GPU access from the host.

The images live under an individual's Docker Hub namespace rather than an organisation, and the tag names say latest, so which Slideflow version you get depends on when the image was last built. The repository carries tensorflow.Dockerfile and torch.Dockerfile, so you can build your own image to pin versions.

The strongest foundation models sit behind non-commercial add-on packages

The core library is Apache-2.0. To add tools and pretrained models available under a non-commercial license, you install two extra packages:

code
pip install slideflow-gpl slideflow-noncommercial

That gives integrated access to six additional pretrained foundation models: UNI, HistoSSL, GigaPath, PLIP, RetCCL and CTransPath. It also adds the MIL architecture CLAM, the uncertainty quantification algorithm BISCUIT, and the GAN framework StyleGAN3.

This split has legal consequences. A project built on the Apache-2.0 core can be used commercially, but once you depend on a model from the add-on packages, the non-commercial terms attach to your work. A company building a diagnostic product cannot treat UNI or GigaPath as freely usable just because Slideflow integrates them.

The library does ship with built-in foundation models of its own,. If commercial use matters, check which model a pipeline actually loads, and read the license for each. The GPL naming of the first add-on package is also a flag that its code carries copyleft conditions.

A preconfigured project downloads slides from the Genomic Data Commons

Slideflow organises experiments into Projects, which supervise storage of whole-slide images, extracted tiles and patient-level annotations. The fastest start is a preconfigured project that automatically downloads slides from the Genomic Data Commons:

python
import slideflow as sf

P = sf.create_project(
    root='/project/destination',
    cfg=sf.project.LungAdenoSquam(),
    download=True
)

After the slides have been downloaded and verified, you skip ahead to extracting tiles from slides. Alternatively you create a new project of your own with local slides and annotations.

The download option has a cost that is easy to miss. Whole-slide images are large, so the call can pull a great deal of data to the destination folder, and the README states no size. Choose a root path on a disk with plenty of space.

Cross-validation has a further optional requirement. For preserved-site cross-validation you need a linear solver, either CPLEX 20.1.0 with its Python API, or Pyomo with the Bonmin solver. Without one of them, that particular split strategy is unavailable.

Training, MIL and explainability are broad, but the last tagged release is from October 2024

The feature list is wide. It covers training with weakly-supervised or strongly-supervised labels, multiple-instance learning, self-supervised learning, GANs, uncertainty quantification and layer activation analysis. Explainability tools include heatmaps, mosaic maps, saliency maps and synthetic histology. There is also Slideflow Studio, an interactive interface for model deployment, launched through the `slideflow-studio` script in the package.

The release list shows 3.0.0 on 2024-08-17, 3.0.1 on 2024-09-06 and 3.0.2 on 2024-10-18. The last push to the master branch was on 2026-10-05, but the newest tag is more than a year old, so the project cannot be described as under active release. Check the commit history rather than assuming a recent version number.

The cap on TensorFlow and protobuf versions fits that picture of a library fixed to an earlier software generation. The README presents it as a scalable platform for digital biomarker development aimed at clinical researchers, which is a research framing, and it makes no regulatory claim for diagnostic use. Treat models trained with it as research artefacts and validate them yourself.

Editorial conclusion

Slideflow fits pathology researchers who want one library for slide processing, stain normalization, MIL and explainability, and who can manage a CUDA environment. It is not a plug-and-play tool: Python and backend versions are pinned tight, the best foundation models sit behind non-commercial add-ons, and the newest tagged release is 3.0.2 from October 2024.

Frequently asked questions

What is a pathology slide in Slideflow?

Slideflow works on whole-slide images, which it reads and splits into tiles. It reads them with cuCIM by default, or with Libvips for formats such as .scn, .mrxs, .ndpi, .vms and .vmu.

How do I install Slideflow?

Run pip3 install slideflow[cucim] cupy-cuda11x after upgrading setuptools, pip and wheel. Docker images and a from-source conda install are the alternatives.

Can Slideflow be used commercially?

The core library is Apache-2.0. The slideflow-gpl and slideflow-noncommercial add-ons, which bring models like UNI and GigaPath, are under non-commercial terms.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. slideflow/slideflow on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/slideflow-slideflow.svg)](https://hysenlabs.com/projects/slideflow-slideflow)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/slideflow-slideflow.svg)](https://hysenlabs.com/projects/slideflow-slideflow)

Was this useful?