This section describes how to builds ITK's Python packages. In most cases, the :ref:`pre-built ITK binary wheels can be used <quick-start>`.
ITK Python packages are built nightly on Kitware build systems and uploaded to the ITKPythonPackage GitHub releases page.
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 dockcross-manylinux-build-wheels.sh will create 64-bit wheels for python 3.9+ in the dist directory.
For example:
$ git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git [...] $ ./scripts/dockcross-manylinux-build-wheels.sh [...] $ ls -1 dist/ itk-6.0.1.dev20251126-cp39-cp39m-manylinux2014_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39mu-manylinux2014_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39m-manylinux2014_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39m-manylinux2014_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39m-manylinux2014_x86_64.whl
First, install the Python.org macOS Python distributions. This step requires sudo:
./scripts/macpython-install-python.sh
Then, build the wheels:
$ ./scripts/macpython-build-wheels.sh [...] $ ls -1 dist/ itk-6.0.1.dev20251126-cp39-cp39m-macosx_10_6_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39m-macosx_10_6_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39m-macosx_10_6_x86_64.whl itk-6.0.1.dev20251126-cp39-cp39m-macosx_10_6_x86_64.whl
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('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
In a PowerShell prompt:
PS C:\Windows> cd C:\
PS C:\> git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git 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-6.0.1.dev20251126-cp39-cp39m-win_amd64.whl
-a---- 4/10/2017 2:08 AM 63257220 itk-6.0.1.dev20251126-cp39-cp39m-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.