pyinstaller / pyinstaller-hooks-contrib

Community maintained hooks for PyInstaller.
Other
96 stars 126 forks source link

hooks: hydra: add work-around for python < 3.10 and PyInstaller >= 5.8 #760

Closed rokm closed 4 months ago

rokm commented 4 months ago

Under python < 3.10, hydra's plugin manager continues to use deprecated PEP-302 functionality that was removed from PyInstaller's PyiFrozenImporter in PyInstaller 5.8 (pyinstaller/pyinstaller#7344.). At run-time, this results in AttributeError: 'PyiFrozenImporter' object has no attribute 'find_module'.

As a work-around, check python version and PyInstaller version, and if using python < 3.10 and PyInstaller >= 5.8, set module collection mode for hydra._internal.core_plugins and hydra_plugins packages to py to collect their modules as source .py files only. This way, they end up handled by python's built-in finder/importer, instead of PyInstaller's PyiFrozenImporter.

rokm commented 4 months ago

Oneshot test: https://github.com/rokm/pyinstaller-hooks-contrib/actions/runs/9898673929