PyInstaller with ITK Python wrapping built from source

Hello,
I need to create windows 7 binaries of Python application that uses ITK, both 64 and 32 bit versions. I successfully created 64 bit version with itk installed using pip and using this hook file, which i found somewhere:

hook file
from PyInstaller.utils.hooks import collect_data_files

hiddenimports = ['new']

# If ITK is pip installed, gets all the files.
itk_datas = collect_data_files('itk',  include_py_files=True)
datas = [x for x in itk_datas if '__pycache__' not in x[0]]

But for my 32 bit Python environment I built itk from source with ITK_WRAP_PYTHON option enabled. It works in interpreter, but i can’t package it using PyInstaller the same way I did with 64 bit. So is there a way to do so? I barely know what i’m doing so any piece of advice would be helpful.

You want to look at the ITKPythonPackage project for packaging ITK wrapping:

We are just about to drop 32-bit support for SimpleITK. May I ask why you are continuing to support 32-bits? The download statistics for SimpleITK 32-bits are so very low compared to 64-bits that it does not appear to be more than bot downloads.

3 Likes