- First, you need to have the Python language installed. Two popular routes are the pip-based Python.org installers and the conda-based miniforge.
- Install
scikit-imagevia pip or conda, as appropriate. - Or, build the package from source. Do this if you'd like to contribute to development.
- Windows 64-bit on x86 processors
- macOS on x86 and ARM (M1, etc.) processors
- Linux 64-bit on x86 and ARM processors
While we do not officially support other platforms, you could still try building from source.
To see whether scikit-image is already installed or to check if an install has
worked, run the following in a Python shell or Jupyter notebook:
import skimage as ski
print(ski.__version__)or, from the command line:
python -c "import skimage; print(skimage.__version__)"(Try python3 if python is unsuccessful.)
You'll see the version number if scikit-image is installed and
an error message otherwise.
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.
# Update pip
python -m pip install -U pip
# Install scikit-image
python -m pip install -U scikit-imageSome additional dependencies are required to access all example
datasets in skimage.data. Install them using:
python -m pip install -U scikit-image[data]To install optional scientific Python packages that expand
scikit-image's capabilities to include, e.g., parallel processing,
use:
python -m pip install -U scikit-image[optional]Warning
Do not use the command sudo and pip together as pip may
overwrite critical system libraries.
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-imageUsing 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.
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()'If you still have questions, reach out through
- our user forum
- our developer forum
- our chat channel
To suggest a change in these instructions, please open an issue on GitHub.
Your system needs a:
- C compiler,
- C++ compiler, and
- a version of Python supported by
scikit-image(see pyproject.toml).
First, fork the scikit-image repository on GitHub.
Then clone your fork locally and set an upstream remote to point to the original scikit-image repository:
Note
We use git@github.com below; if you don't have SSH keys setup, use
https://github.com instead.
git clone git@github.com:YOURUSERNAME/scikit-image
cd scikit-image
git remote add upstream git@github.com:scikit-image/scikit-imageAll commands below are run from within the cloned scikit-image directory.
Set up a Python development environment tailored for scikit-image.
Here we provide instructions for two popular environment managers:
venv (pip) and conda (miniforge).
# 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 -m venv ~/envs/skimage-dev
# Activate it
# (On Windows, use ``skimage-dev\Scripts\activate``)
source ~/envs/skimage-dev/bin/activate
# Install development dependencies
pip install -r requirements.txt
pip install -r requirements/build.txt
# Install scikit-image in editable mode. In editable mode,
# scikit-image will be recompiled, as necessary, on import.
spin install -vTip
The above installs scikit-image into your environment, which makes it accessible to IDEs, IPython, etc. This is not strictly necessary; you can also build with:
spin buildIn that case, the library is not installed, but is accessible via
spin commands, such as spin test, spin ipython, spin run,
etc.
We recommend installing conda using miniforge, an alternative to Anaconda without licensing costs.
After installing miniforge:
# Create a conda environment with required dependencies
conda env create -f environment.yml
# Activate it
conda activate skimage-dev
# Install scikit-image in editable mode. In editable mode,
# scikit-image will be recompiled, as necessary, on import.
spin install -vTip
The above installs scikit-image into your environment, which makes it accessible to IDEs, IPython, etc. This is not strictly necessary; you can also build with:
spin buildIn that case, the library is not installed, but is accessible via
spin commands, such as spin test, spin ipython, spin run,
etc.
Run the complete test suite:
spin testOr run a subset of tests:
# Run tests in a given file
spin test skimage/morphology/tests/test_gray.py
# Run tests in a given directory
spin test skimage/morphology
# Run tests matching a given expression
spin test -- -k local_maximaWhen contributing a new feature, do so via a feature branch.
First, fetch the latest source:
git switch main
git pull upstream mainCreate your feature branch:
git switch --create my-feature-nameUsing an editable install, scikit-image will rebuild itself as
necessary.
If you are building manually, rebuild with:
.. code-block:: sh
spin build
Repeated, incremental builds usually work just fine, but if you notice build problems, rebuild from scratch using:
spin build --cleanWindows
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-essentialBuild Requirements
Runtime Requirements
Test Requirements
Documentation Requirements
Developer Requirements
Data Requirements
The full selection of demo datasets is only available with the following installed:
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
daskmodule is used to parallelize certain functions.
More rarely, you may also need:
- PyAMG
The
pyamgmodule is used for the fastcg_mgmode of random walker segmentation. - Astropy Provides FITS I/O capability.
- SimpleITK Optional I/O plugin providing a wide variety of formats. including specialized formats used in biomedical imaging.
See Additional help above.