raidionics / Raidionics

Software for automatic segmentation and generation of standardized clinical reports of brain tumors from MRI volumes
https://raidionics.github.io/
BSD 2-Clause "Simplified" License
31 stars 4 forks source link

PyInstaller packages ALL local python versions when building #31

Closed andreped closed 11 months ago

andreped commented 2 years ago

If you have more than one python version, it will bundle all of these into the package. What then happens, is that during runtime, the executable will fail to find the correct on. This results in the software never starting. This is not a problem for the CI build stuff, but for building locally it may be a problem.

A temporary fix is to delete the Python38.dll (and any other PythonX.dll files), except Python37.dll which the correct one. Then the program will open. We should find a better way of catching these dependencies. Probably the hidden_imports solution is too naive.

andreped commented 11 months ago

This is apparently a bug in PyInstaller: https://github.com/pyinstaller/pyinstaller/issues/7102

It might also be a windows-only issue, due to how hidden imports and dependencies are collected (DLLs), which likely runs into the Windows-only DLL hell problem.

andreped commented 11 months ago

A PR was made to address this issue in PyInstaller: https://github.com/pyinstaller/pyinstaller/pull/7114

Thus, upgrading to a later version of PyInstaller likely resolves this issue. PyInstaller v6.0.0 was released two days ago. Perhaps give that a go: https://github.com/pyinstaller/pyinstaller/releases/tag/v6.0.0

andreped commented 11 months ago

Of course, PyInstaller deprecated Python 3.7 a while a go. The latest PyInstaller version that officially supports Python 3.7 was version 5.1. However, it might still be that it works fine with PyInstaller v6.0.0, as a single wheel is built for all python versions, for each OS respectively.

andreped commented 11 months ago

I tried the latest PyInstaller version, but seems like it is no longer compatible with Python 3.7. The latest compatible version is likely 5.13.2, so I tried using that instead (running tests now).

The PR mentioned above was merged in Sept. 2022 into PyInstaller's develop branch. However, I am not sure when it was merged to main (likely done before each release). In that case, I checked the changelog and surprisingly no reference of the PR was made. So I assume this fix was merged in earliest in v5.5 (see changelog date here). Nonetheless, using 5.13.2, if it is compatible with Raidionics, should resolve this issue.

andreped commented 11 months ago

Made PR https://github.com/raidionics/Raidionics/pull/47.