-
Notifications
You must be signed in to change notification settings - Fork 252
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
Issue when running pyinstaller generated .exe #332
Comments
That's an interesting problem. Can you confirm it has access to a binding? E.g. your program should be able to call It was a while since I worked with pyinstaller, so I'm not sure what hidden imports do. But at the end of the day, Qt.py is importing a binding like PyQt5 and creating its inner namespaces - such as QtWidgets - from that. If what you use/bundle is PySide2, then you may perhaps be so bold as to simply say |
Some more info - I'd like to write a desktop application, using PySide2 under the LGPL terms, which means (among other things) I have to give the user the ability to replace the bundled PySide2 version with his/her own. I was looking into Qt.py for that reason, so my own code doesn't even mention a specific PySide version, and let Qt.Py handle that part. This works fine when running from a .py file, but somehow breaks when freezing the application via pyinstaller. I'll try the |
From what I understand, this is by design. The freezing process is meant to remove any dependency on the source system, the Python distribution and any libraries. As far as I understand, your frozen application isn't exposed to the same But I would be surprised if you couldn't circumvent this; e.g. if the user installed PySide2 at If so, then you should also find that |
Hah, good point you got there. I'll check that asap and report back. Cheers! |
I am having a similar issue getting Qt.py to work with pyinstaller, I wrote up a simple helloworld example and am trying to get answers on stackoverflow below, I would appreciate any help in understnading how to generate an exe with pyinstaller. My tests show if I just replace Wt with Pyside2 then I can build the exe but I dont want to have to modify my source to build a distribution. https://stackoverflow.com/questions/60977939/pyinstaller-creating-a-standalone-executable-that-uses-qt-py/60979774#60979774 |
You just have to add PySide2 modules as hidden imports in the PyInstaller spec file then its all fine. In my spec file i just set |
It might be possible to avoid this problem by adding PyInstaller Hooks to this package. If there is interests I could look at making a PR for it. |
Howdy @cmcpasserby and @tobkum. I'm also interested in using Qt.py with PyInstaller to satisfy the PySide2 LGPL terms. https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/utils/hooks/qt.py |
I'm having an issue with Qt.py in conjunction with pyinstaller. When trying to run the frozen .exe, I get an "ImportError: cannot import name 'QtWidgets' from 'Qt' (E:\xxxx\Qt.pyc)" - (xxxx replacing the path). That pyc file mentioned in the error doesn't exist.
Do I have to use hidden imports when freezing an application with Qt.py or what seems to be the issue here?
Thanks!
The text was updated successfully, but these errors were encountered: