Generate binary file with pyinstaller
-
wrote on 29 Aug 2023, 11:53 last edited by
Hello,
I try to generate a binary file with pyinstaller. I have a program using PySide2.
I generate my binary withpyinstaller --onefile main.py -y
When I run the generated binary file, I get that error:
Traceback (most recent call last): File "main.py", line 4, in <module> from PySide2.QtWidgets import QApplication, QMainWindow ImportError: /tmp/_MEIA5cWN3/libQt5Widgets.so.5: undefined symbol: _ZN9QFileInfo4statEv, version Qt_5 [67652] Failed to execute script 'main' due to unhandled exception!
-
wrote on 4 Sept 2023, 10:04 last edited by
@SGaist I have the same trouble.
According to that documentation, pyinstaller use the system environment to build the binary file:
https://doc.qt.io/qtforpython-5/deployment-pyinstaller.htmlSo if I use Conda, Virtual Env, it will alway use the systm environment to generate the binary.
-
Hi,
How did you install PySide2 ?
Are you sure pyinstaller is using the correct Qt version to create the package ? -
Hi,
How did you install PySide2 ?
Are you sure pyinstaller is using the correct Qt version to create the package ? -
@SGaist I use pip to install Pyside2.
How could I specify the version of Qt on pyinstaller?
The command I used is the one in the first post.
Did you create a virtual environment ?
-
I would rather do that in a dedicated environment to keep everything cleanly separated.
-
wrote on 31 Aug 2023, 08:24 last edited by Xav12358
@SGaist I generate a virtuel environment
I still use that command to generate the installer:
pyinstaller --onefile main.py -y
I get that error when I run
./dist/main
Traceback (most recent call last): File "main.py", line 4, in <module> from PySide2.QtWidgets import QApplication, QMainWindow ImportError: could not import module 'PySide2.QtGui' [154703] Failed to execute script 'main' due to unhandled exception!
-
wrote on 31 Aug 2023, 15:33 last edited by
In fact, I think I find the trouble. I include matplotlib and Pyside2
One is Using Qt5.15.0 and the other Qt5.15.2.
How can I manage to use Matplotlib and PySide2 with the same Qt library version?
How can I know with Qt version matplotlib use and also Pyside. I would like to specify the version of both library to avoid the trouble
-
In fact, I think I find the trouble. I include matplotlib and Pyside2
One is Using Qt5.15.0 and the other Qt5.15.2.
How can I manage to use Matplotlib and PySide2 with the same Qt library version?
How can I know with Qt version matplotlib use and also Pyside. I would like to specify the version of both library to avoid the trouble
How did you install matplotlib ?
-
Can you try with conda ? If memory serves well, they should pull the same Qt version in.
-
wrote on 4 Sept 2023, 10:04 last edited by
@SGaist I have the same trouble.
According to that documentation, pyinstaller use the system environment to build the binary file:
https://doc.qt.io/qtforpython-5/deployment-pyinstaller.htmlSo if I use Conda, Virtual Env, it will alway use the systm environment to generate the binary.
-
@SGaist I have the same trouble.
According to that documentation, pyinstaller use the system environment to build the binary file:
https://doc.qt.io/qtforpython-5/deployment-pyinstaller.htmlSo if I use Conda, Virtual Env, it will alway use the systm environment to generate the binary.
Then clean your system Python and work exclusively from the virtual environment.
-
1/14