Skip to content

Enable Python import analysis for bundlers like pyinstaller, py2app, py2exe #214

Closed

Description

@thewtex

Python tools to bundle applications and generate installers analyze Python import's to determined what should be included in the package. Some examples include pyinstaller, py2app, py2exe.

To enable these apps to work with the ITK Python package, we need to make some changes to itkBase.py, e.g.

Activity

  1. added
    area:Python wrapping
    on Nov 20, 2018
  2. fbudin69500 commented on Jan 18, 2019

    @fbudin69500
    Contributor

    pyinstaller can be used with ITK if a hook is provided. The hook file should be named hook-itk.py and its content should be:

    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]]
    
  3. fbudin69500 commented on Jan 22, 2019

    @fbudin69500
    Contributor
  4. fbudin69500 commented on Jan 24, 2019

    @fbudin69500
    Contributor

    In the meantime, before the PR is merged in pyinstaller (See link above), one can use the hook file above and add the following file to their command line when calling pyinstaller: --additional-hooks-dir

  5. fbudin69500 commented on Feb 14, 2019

    @fbudin69500
    Contributor

    Closing this issue as there is no problem in ITK to use PyInstaller (see comments and links above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:Python wrapping

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions