Python Forum
PySide2 with QtQuick & pyInstaller --> big executeable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PySide2 with QtQuick & pyInstaller --> big executeable
#1
Hi,

i experimented a little bit with PySide2 in combinatin with QtQuick & pyInstaller. I just build a small demo application which loads a QML file and displays the UI.

So far it works well, with one exception: the resulting EXE is really huge. About 700MB Shocked

I did searched a bit to extract the packed DLLs and recognized that pyinstallers builds the executable with Debug&Release Qt DLLs.

Can someone point me to a direction where a can choose only to pack the Release Qt DLLs?
Reply
#2
This is normal if you use Qt5 and pyinstaller. To prevent compatibility issues, the entire Qt5 is copied to the app.
Reply
#3
Among the goal of PySide2, they aim to ease the deployment. Hopefully this will get better in the next year or so. Meanwhile, the best way to package PyQt projects seems to be PyPi.
Reply
#4
Thanks for your answers.
Please do not confuse PySide2 with Qt5.

I found one solution: i explored the packed DLLs (debug&release) and recognized it was Qt5.12 although I installed PySide2 with Qt 5.12.1.
I researched a bit and found out that the DLLs came from a previously installed Qt-SDK(5.12) installed by me. Why that?:
  • PyInstaller uses a hook to resolve the QML dependencies hook-PySide2.QtQuick.py
  • this hook uses the PATH variable "QT5DIR" to find qmake.exe
  • qmake.exe is called with PATH variable "QT_INSTALL_QML" as argument
  • the call result points to the QML directory

Solution:
PySide2 doesnt include qmake.exe on its own (or i didnt found it) So a quick and dirty fix was to insert a hardcoded path into hook-PySide2.QtQuick.py which points to <pythoninstalldir>\Python37\Lib\site-packages\PySide2\qml

Result:
The resulting executable packed with PyInstaller is around 33MB. :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PySide2 and QMediaPlayer menator01 19 6,782 Oct-11-2021, 05:26 PM
Last Post: menator01
  Tkinter vs Pyside2 twallace51 1 3,104 Apr-21-2019, 05:16 PM
Last Post: Larz60+
  Pyside2 darktitan 2 3,993 Aug-08-2018, 06:09 PM
Last Post: darktitan
  [PySide2][PyQt5] update QTableView cpuin 0 5,222 Mar-07-2018, 10:20 PM
Last Post: cpuin
  Problem on installing PySide2 on Mac cpuin 5 4,936 Feb-03-2018, 08:40 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020