Build ITK Python packages

This section describes how to builds ITK’s Python packages. In most cases, the pre-built ITK binary wheels can be used.

ITK Python packages are built nightly on Kitware build systems and uploaded to the ITKPythonPackage GitHub releases page.


Building wheels requires:

  • CMake
  • Git
  • C++ Compiler - Platform specific requirements are summarized in scikit-build documentation.
  • Python

Automated platform scripts

Steps required to build wheels on Linux, macOS and Windows have been automated. The following sections outline how to use the associated scripts.


On any linux distribution with docker and bash installed, running the script will create 64-bit wheels for both python 2.x and python 3.x in the dist directory.

For example:

$ git clone

$ ./scripts/

$ ls -1 dist/


First, install the macOS Python distributions. This step requires sudo:


Then, build the wheels:

$ ./scripts/

$ ls -1 dist/


First, install Microsoft Visual Studio 2015, Git, and CMake, which should be added to the system PATH environmental variable.

Open a PowerShell terminal as Administrator, and install Python:

PS C:\> Set-ExecutionPolicy Unrestricted
PS C:\> $pythonArch = "64"
PS C:\> iex ((new-object net.webclient).DownloadString(''))

In a PowerShell prompt:

PS C:\Windows> cd C:\
PS C:\> git clone IPP
PS C:\> cd IPP
PS C:\IPP> .\scripts\windows-build-wheels.ps1

PS C:\IPP> ls dist
    Directory: C:\IPP\dist

    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----         4/9/2017  11:14 PM       63274441 itk-4.11.0.dev20170407-cp35-cp35m-win_amd64.whl
    -a----        4/10/2017   2:08 AM       63257220 itk-4.11.0.dev20170407-cp36-cp36m-win_amd64.whl

We need to work in a short directory to avoid path length limitations on Windows, so the repository is cloned into C:IPP.

Also, it is very important to disable antivirus checking on the C:IPP directory. Otherwise, the build system conflicts with the antivirus when many files are created and deleted quickly, which can result in Access Denied errors. Windows 10 ships with an antivirus application, Windows Defender, that is enabled by default.


To create source distributions, sdist’s, that will be used by pip to compile a wheel for installation if a binary wheel is not available for the current Python version or platform:

$ python sdist --formats=gztar,zip

$ ls -1 dist/

Manual builds

Building ITK Python wheels

Build the ITK Python wheel with the following command:

python3 -m venv build-itk
./build-itk/bin/pip install --upgrade pip
./build-itk/bin/pip install -r requirements-dev.txt numpy
./build-itk/bin/python bdist_wheel

Build a wheel for a custom version of ITK

To build a wheel for a custom version of ITK, point to your ITK git repository with the ITK_SOURCE_DIR CMake variable:

./build-itk/bin/python bdist_wheel -- \

Other CMake variables can also be passed with -D after the double dash.