# ITK Python pyinstaller issue

**URL:** <https://discourse.itk.org/t/itk-python-pyinstaller-issue/1520>\
**Category:** Uncategorized\
**Created:** [January 11, 2019, 6:02pm UTC](https://discourse.itk.org/t/itk-python-pyinstaller-issue/1520 "2019-01-11T18:02:12Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![fbudin](https://discourse.itk.org/user_avatar/discourse.itk.org/fbudin/32/14_2.png) [@fbudin](https://discourse.itk.org/u/fbudin)\
**Post date:** [January 18, 2019, 7:17pm UTC](https://discourse.itk.org/t/itk-python-pyinstaller-issue/1520/4 "2019-01-18T19:17:41Z")

</div>

You can try to use a hook file with this content:

```
# This pyinstaller hook file does not support ITK with `WrapITK.pth`.

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]]

```

Save the code above in a file called `hook-itk.py` and add `--additional-hooks-dir=` to the command line calling pyinstaller, with the name of the folder in which you saved `hook-itk.py`.

If this works for you, I will ask pyinstaller if they can ship this hook file directly in their project.  
Thanks!

---

_[View the full topic](https://discourse.itk.org/t/itk-python-pyinstaller-issue/1520)._
