You’ll see the version number if scikit-image is installed and
an error message otherwise.
1.3. Installation via pip and conda
1.3.1. pip
Prerequisites to a pip install: you must be able to use pip on
your command line to install packages.
We strongly recommend the use of a
virtual environment.
A virtual environment creates a clean Python environment that does not interfere
with the existing system installation, can be easily removed, and contains only
the package versions your application needs.
To install the current scikit-image you’ll need at least Python 3.11. If
your Python is older, pip will find the most recent compatible version.
Some additional dependencies are required to access all example
datasets in skimage.data. Install them using:
python-mpipinstall-Uscikit-image[data]
To install optional scientific Python packages that expand
scikit-image’s capabilities to include, e.g., parallel processing,
use:
python-mpipinstall-Uscikit-image[optional]
1.3.2. conda
We recommend miniforge, a minimal
distribution that makes use of conda-forge.
It installs Python and provides virtual environments.
Once you have your conda environment set up, install scikit-image with:
conda install scikit-image
1.4. System package managers
Using a package manager (apt, dnf, etc.) to install scikit-image
or other Python packages is not your best option, since you’re likely
to get an older version. It also becomes harder to install other Python packages
not provided by the package manager.
1.5. Downloading all demo datasets
Some of our example images (in skimage.data) are hosted online and are
not installed by default. These images are downloaded upon first
access. If you prefer to download all demo datasets, so they can be
accessed offline, ensure that pooch is installed, then run:
python-c'import skimage as ski; ski.data.download_all()'
All commands below are run from within the cloned scikit-image directory.
2.1. Build environment setup
Set up a Python development environment tailored for scikit-image.
Here we provide instructions for two popular environment managers:
venv (pip) and conda (miniforge).
2.1.1. venv
# Create a virtualenv named ``skimage-dev`` that lives outside of the repository.# One common convention is to place it inside an ``envs`` directory under your home directory:
mkdir~/envs
python-mvenv~/envs/skimage-dev
# Activate it# (On Windows, use ``skimage-dev\Scripts\activate``)source~/envs/skimage-dev/bin/activate
# Install development dependencies
pipinstall-rrequirements.txt
pipinstall-rrequirements/build.txt
# Install scikit-image in editable mode. In editable mode,
spininstall-v
2.2. Testing
Run the complete test suite:
spintest
Or run a subset of tests:
# Run tests in a given file
spintestskimage/morphology/tests/test_gray.py
# Run tests in a given directory
spintestskimage/morphology
# Run tests matching a given expression
spintest---klocal_maxima
2.3. Adding a feature branch
When contributing a new feature, do so via a feature branch.
First, fetch the latest source:
git switch main
git pull upstream main
Create your feature branch:
git switch --create my-feature-name
Using an editable install, scikit-image will rebuild itself as
necessary.
If you are building manually, rebuild with:
..code-block::sh
2.4. Platform-specific notes
Windows
Building scikit-image on Windows is done as part of our continuous
integration testing; the steps are shown in this Azure Pipeline.
Debian and Ubuntu
Install suitable compilers prior to library compilation:
sudo apt-get install build-essential
2.5. Full requirements list
Build Requirements
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.meson-python>=0.16ninja>=1.11.1.1Cython>=3.0.8,!=3.2.0b1pythran>=0.16numpy>=2.0spin==0.13build>=1.2.1
# scikit-image will be recompiled, as necessary, on import.
2.1.2. conda
We recommend installing conda using
miniforge,
an alternative to Anaconda without licensing costs.
After installing miniforge:
# Create a conda environment with required dependencies
condaenvcreate-fenvironment.yml
# Activate it
condaactivateskimage-dev
# Install scikit-image in editable mode. In editable mode,# scikit-image will be recompiled, as necessary, on import.
spininstall-v
spin build
Repeated, incremental builds usually work just fine, but if you notice build
problems, rebuild from scratch using:
spin build --clean
Runtime Requirements
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.numpy>=1.24scipy>=1.11.4networkx>=3.0pillow>=10.1imageio>=2.33,!=2.35.0tifffile>=2022.8.12packaging>=21lazy-loader>=0.4
Test Requirements
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.numpydoc>=1.7pooch>=1.6.0;sys_platform!="emscripten"pytest>=8.3pytest-cov>=2.11.0pytest-prettypytest-localserverpytest-faulthandlerpytest-doctestplus>=1.6.0
Documentation Requirements
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.sphinx>=8.0sphinx-gallery[parallel]>=0.18numpydoc>=1.7sphinx-copybuttonmatplotlib>=3.7dask[array]>=2023.2.0pandas>=2.0seaborn>=0.11pooch>=1.6tifffile>=2022.8.12myst-parserintersphinx-registry>=0.2411.14ipywidgetsipykernelplotly>=5.20kaleido==0.2.1scikit-learn>=1.2sphinx_design>=0.5pydata-sphinx-theme>=0.16PyWavelets>=1.6pytest-doctestplus>=1.6.0
Developer Requirements
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.pre-commitipythondocstub==0.3.0.post0asv;sys_platform!="emscripten"
Data Requirements
The full selection of demo datasets is only available with the
following installed:
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.pooch>=1.6.0
Optional Requirements
You can use scikit-image with the basic requirements listed above, but some
functionality is only available with the following installed:
Matplotlib
Used in various functions, e.g., for drawing, segmenting, reading images.
Dask
The dask module is used to parallelize certain functions.
More rarely, you may also need:
PyAMG
The pyamg module is used for the fast cg_mg mode of random
walker segmentation.
SimpleITK
Optional I/O plugin providing a wide variety of formats.
including specialized formats used in biomedical imaging.
# Generated via tools/generate_requirements.py and pre-commit hook.# Do not edit this file; modify pyproject.toml instead.SimpleITK;sys_platform!="emscripten"scikit-learn>=1.2pyamg>=5.2;sys_platform!="emscripten"andpython_version<"3.14"astropy>=6.0dask[array]>=2023.2.0matplotlib>=3.7pooch>=1.6.0;sys_platform!="emscripten"PyWavelets>=1.6