-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Problems running pyqt tutorial on cx_freeze 7.2.4 #2676
Comments
Thanks for the quick response Marcelo. Can you confirm the pyqt version that you used? I am using a conda environment here with: |
I always use the latest packages to test.
|
Hi Marcelo, i might be missing something here, hope you can give me some light: When i create a conda env with only python, and then use pip to install cx_freeze and qt, the tutorial works fine I compared the the environment variable PATH on both created executables: import os And it called my attention that the binary created from pip package contains the folders:
While the binary created using conda package only contains the lib folder (it does not contains the bin folder where the Qt5Core is located)
(I am omitting other folders that are present in both binaries.) Do you have any idea why the paths are different when qt is created from pip or conda packages? |
PyQt5 installed from pip has the modules an libraries in the same directory (libraries is in the PyQt5/lib) while the conda installation the directory structure is different. You can use an environment variable to check this. |
Ok Marcelo i see that the pip and conda packages have some layout differences. To avoid this i decided to compare cx_freeze 6.15.12 (the version currently used by our project and in this version the tutorial works fine) and the cx_freeze 7.2.4 (the binary created from this version crashes in my machine when loading QtCore). Both versions uses the same pyqt conda package (5.15.19) In version 6.15.12 the Qt5Core.pyd and Qt5Core_conda.dll are located in the same folder (\lib\PyQt5) From what i saw in code, the Qt5Core_conda.dll is copied to the bin folder because the function load_qt_qtcore inside _qthooks is using the library info (BinariesPath) to identify to where the files should be copied. and in my machine this is what is printed in the freeze output:
The change to copy the qt5Core_conda.dll to the bin folder is expected? If that is so how can the executable find the dll if that folder is not in the path? is it added with AddDllDirectory? If this change is not expected i can test different freeze versions and check the version where the files stated to be copied to different folders. Thanks |
This is expected. Between 7.2.0 and 7.2.2 there are a series of fixes to solve duplicate files and files copied to wrong directories. One of these fixes is in #2578. The PATH is not used to search the libraries, especially in Python 3.8+. |
Ok, if i add a call to os.add_dll_directory(<executable_path>\lib\PyQt5\Qt5\bin) then the example works fine. I will continue debugging to find what is wrong in my machine / env. Thanks for the help |
Sorry if this is not the correct place to ask for it. I believe that the pyqt sample is outdated/missing some steps
I can run the pyqt sample application (test_pyqt.py) in dev mode and run the created binary correctly when using cx_freeze 6.15.12 and pyqt 5.15.9
However if i use cx_freeze 7.2.4 and the same pyqt, when i run the created binary the application crashes when loading pyqt:
The only change that i made from cx_freeze 6,15,12 to 7.2.4 was in setup.py file the executable base changed from "Win32GUI" to "gui".
Can you please confirm that the pyqt sample works with cx_freeze 7.2.4?
Thanks
The text was updated successfully, but these errors were encountered: