-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Pyinstaller can not freeze SVD functions #4968
Comments
All 3 work for me using exactly the same (as far as I can tell) environment as you. Can we have the run-time traceback? Run your exe from cmd to see it without it closing immediately. |
Hi! I made a change on the code to be able to see more clearly the problem... I included a waiting time at the end as a message for the routine's ending:
Now, when using the console there is no problem; all the three SVD functions work fine. However, the problem comes when you use the "frozen" application. It gets out before reaching the waiting time, for an unknown (ant not warned/printed) error. Here is the run-time traceback by executing the frozen application on the console:
** It terminates suddenly after this line and no error message is displayed |
I think I know what this is. The numpy hooks are missing a dll called python -c "from ctypes.util import find_library; print(find_library('libiomp5md'))" This should print a filename. Copy that file into you app (in the same folder as the .exe file). It should run then normally? Edit: We seem to be referring to this answer a lot so it's worth elaborating. You can just copy and paste the file into your app as a proof of concept fix but the proper way to add it is using from ctypes.util import find_library
...
a = Analysis(
...,
binaries=[find_library("libiomp5md", ".")]
...
) It's also worth pointing out that there are a long list of other DLLs which also aren't found. You tend not to get a crash for these because they come with a lot of standard developer tools e.g. git-bash for Windows. So your broken app, instead of crashing, finds these other copies of those DLLs and appears to work. But if you put that program on a machine which doesn't have git-bash or clang or various other tools it'll break. We've had no success fixing this as there are too many of these DLLs to track. The only way to avoid this issue is to not use conda, or failing that, install numpy with pip. |
Hi, I copied the binary as you said, and the program runs without a problem. I will add this binary into the spec file of my original project and hopefully it will run all! Thanks a lot! |
Whilst I'm here also: - Exclude numpy's testing and C/Fortran compiling code, and everything else it drags with it (namely scipy). - Try to fix Conda support. - Avoid dragging 400MB of unused MKL DLLs on Conda. They're all closed due to our no-conda policy but, (for now) fixes pyinstaller#4935, pyinstaller#4968, pyinstaller#5075, pyinstaller#5082, pyinstaller#5019 and pyinstaller#5019. Although likely at the expense of junk DLLs being dragged in.
Whilst I'm here also: - Exclude numpy's testing and C/Fortran compiling code, and everything else it drags with it (namely scipy). - Try to fix Conda support. - Avoid dragging 400MB of unused MKL DLLs on Conda. They're all closed due to our no-conda policy but, (for now) fixes pyinstaller#4935, pyinstaller#4968, pyinstaller#5075, pyinstaller#5082, pyinstaller#5019 and pyinstaller#5019. Although likely at the expense of junk DLLs being dragged in.
Hi, I am not using conda, I am using venv on windows10. When I pass the line mentioned above to hit the dll file, I would receive "None". Do you have any other suggestions where this error arises from? I was able to combine numpy, conda and savefig in another application a year ago. Bests, Cati |
Open a new issue then. If you're not using conda then your issue isn't this issue. |
Welcome to the PyInstaller issue tracker! Before creating an issue, please heed the following:
http://www.pyinstaller.org/support.html#mailing-list
the original discussion.
maintainers to reproduce, the faster it'll be fixed.
-->
Description of the issue
I have been trying to freeze a python script that contains an instance of an SVD function (single value decomposition) without success. Everytime the executable runs it, it crashes the program without any error message or exception that I can catch (nor any message appears with the --debug option of pyinstaller). However, when I remove this function of the code, everything works fine.
What is the most surprising of this problem, is that the executable works fine if I run it through the conda prompt. But fails if it is run by double-clicking it. Adding all the missing .dll dependancies that the build log mentions does not fix this issue.
I isolated the problem using a minimal script containing only the SVD. I tried three homologous functions from OpenCV (4.3.0), Numpy (1.18.5) and Scipy (1.5.0), and all three fail (although the OpenCV version seems to work sometimes).
Thanks for your support, and I hope this issue might just be something trivial.
I'm using:
A minimal example program which shows the error
Build Log
The text was updated successfully, but these errors were encountered: