Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing imports during packaging with PyInstaller 5.13 and pyinstaller-hooks-contrib 2023.12 #686

Open
rly opened this issue Jan 9, 2024 · 2 comments

Comments

@rly
Copy link

rly commented Jan 9, 2024

Describe the bug
Using PyInstaller 5.13 and the latest pyinstaller-hooks-contrib 2023.12 release results in ModuleNotFoundError: No module named 'h5py.defs' when running our tests on a PyInstaller executable (NeurodataWithoutBorders/nwb-guide#559). Tests were passing with version 2023.11 using the same version of PyInstaller 5.13. Pinning pyinstaller-hooks-contrib to the earlier 2023.11 fixes the issue. Upgrading PyInstaller to the latest 6.3.0 also fixes the issue. So there seems to be an incompatibility between PyInstaller 5.13 and the latest pyinstaller-hooks-contrib 2023.12. I have not tested other versions beyond those mentioned.

The h5py hooks should have been loaded from https://github.com/pyinstaller/pyinstaller-hooks-contrib/blob/master/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-h5py.py but the logs indicate that they were not. This PR #677 was merged in 2023.12 . Since it relates to how pyinstaller finds hooks, I wonder if this caused the issue.

Since I was able to resolve this issue by upgrading to the latest version of PyInstaller, I have no requests. I'm creating this ticket to let you all know about the incompatibility and inform anyone else who might encounter the same issue. Feel free to close this.

To Reproduce
Sorry, I am not a pyinstaller expert and creating a MWE would take some time...

Expected behavior
Expected no change in pyinstaller behavior between pyinstaller-hooks-contrib = 2023.11 and pyinstaller-hooks-contrib = 2023.12.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: tested in Ubuntu, Mac. Not sure about Windows
  • Python Version: 3.9
  • Version of pyinstaller-hooks-contrib: 2023.12
  • Version of PyInstaller: 5.13

Additional context

@rly rly added the state:triage We're still figuring out how severe this issue is label Jan 9, 2024
@rokm
Copy link
Member

rokm commented Jan 9, 2024

https://github.com/NeurodataWithoutBorders/nwb-guide/actions/runs/7409596543/job/20160174711#step:11:492

In the failed run, the pyinstaller-hooks-contrib hooks are not registered, because the installed packaging version does not meet the minimum version requirement (pyinstaller-hooks-contrib 2023.12 added a dependency on packaging >= 22.0 in #676).

I cannot reproduce the problem when doing a pip install pyinstaller==5.13.2 in a clean virtual environment made with python.org python - the latest version of packaging (23.2 at the time of writing) is installe).

I do note, however, that you are installing pyinstaller and pyinstaller-hooks-contrib from conda, so my guess would be that they do not properly declare the new dependency in their pyinstaller-hooks-contrib package. (PyInstaller >= 6.0 also depends on packaging >= 22.0, and it is likely that conda does properly declare that dependency for PyInstaller package; that's why it works for PyInstaller 6.3, but not for 5.13.2).

@rokm rokm removed the state:triage We're still figuring out how severe this issue is label Jan 9, 2024
@rly
Copy link
Author

rly commented Jan 9, 2024

Thanks @rokm for the detailed investigation! The issue with packaging makes sense. Indeed, the conda-forge version of PyInstaller, pyinstaller-feedstock, added packaging>=20.0 as a requirement in PyInstaller 6.0, and the conda-forge version of pyinstaller-hooks-contrib does not list packaging as a requirement

I created an issue and PR on conda-forge/pyinstaller-hooks-contrib-feedstock#40 to add the packaging >= 22.0 requirement. I also created an issue and PR on conda-forge/pyinstaller-feedstock#106 to update the packaging >= 20.0 -> 22.0 requirement for PyInstaller 6.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants