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

PyQT 5.7 DLLs are not bundled #2152

Closed
AcidWeb opened this Issue Aug 20, 2016 · 17 comments

Comments

Projects
None yet
10 participants
@AcidWeb

AcidWeb commented Aug 20, 2016

PyInstaller: 3.3.dev0+e78b701
Python: 3.5.1
Platform: Windows-10-10.0.14393-SP0

It look like PyQT5 hook is not updated to new PyQT5 structure. PyQT no longer depends on system QT - all DLLs are now part of the wheel.
Directory qt5_plugins is created correctly but DLLs from Lib\site-packages\PyQt5\Qt\bin are not bundled.

PyInstaller build logs clearly states that it fail to find DLLs.

It can be easily replicated:
test.py:
from PyQt5 import QtGui, QtCore, QtWidgets, QtNetwork

pyinstaller test.py

@kz26

This comment has been minimized.

Show comment
Hide comment
@kz26

kz26 Aug 29, 2016

Contributor

Can confirm. Copying the DLLs over works.

Contributor

kz26 commented Aug 29, 2016

Can confirm. Copying the DLLs over works.

@akej74

This comment has been minimized.

Show comment
Hide comment
@akej74

akej74 Sep 22, 2016

Second to confirm. As a workaround I added the following to my .spec file to automatically copy the DLLs.

# -*- mode: python -*-

block_cipher = None

added_files = [
               ('C:\\Python35-32\\Lib\\site-packages\\PyQt5\\Qt\\bin\\Qt5Core.dll', '.'),
               ('C:\\Python35-32\\Lib\\site-packages\\PyQt5\\Qt\\bin\\Qt5Gui.dll', '.'),
               ('C:\\Python35-32\\Lib\\site-packages\\PyQt5\\Qt\\bin\\Qt5Widgets.dll', '.')
              ]

a = Analysis(['gridcontrol.py'],
             pathex=['C:\\...'],
             binaries=[],
             datas=added_files,
...

akej74 commented Sep 22, 2016

Second to confirm. As a workaround I added the following to my .spec file to automatically copy the DLLs.

# -*- mode: python -*-

block_cipher = None

added_files = [
               ('C:\\Python35-32\\Lib\\site-packages\\PyQt5\\Qt\\bin\\Qt5Core.dll', '.'),
               ('C:\\Python35-32\\Lib\\site-packages\\PyQt5\\Qt\\bin\\Qt5Gui.dll', '.'),
               ('C:\\Python35-32\\Lib\\site-packages\\PyQt5\\Qt\\bin\\Qt5Widgets.dll', '.')
              ]

a = Analysis(['gridcontrol.py'],
             pathex=['C:\\...'],
             binaries=[],
             datas=added_files,
...
@stlehmann

This comment has been minimized.

Show comment
Hide comment
@stlehmann

stlehmann Sep 27, 2016

You can also use the --path option of pyinstaller to get it working:

pyinstaller --path C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin test.py

should work.

Also it' s possible to insert the bin path to pathex in the .spec file. Works also for virtual environments.

a = Analysis(['app.py'],
             pathex=['venv\\Lib\\site-packages\\PyQt5\\Qt\\bin'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)

stlehmann commented Sep 27, 2016

You can also use the --path option of pyinstaller to get it working:

pyinstaller --path C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin test.py

should work.

Also it' s possible to insert the bin path to pathex in the .spec file. Works also for virtual environments.

a = Analysis(['app.py'],
             pathex=['venv\\Lib\\site-packages\\PyQt5\\Qt\\bin'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
@akej74

This comment has been minimized.

Show comment
Hide comment
@akej74

akej74 Sep 29, 2016

@MrLeeh, thanks for your help, I will try it out.

akej74 commented Sep 29, 2016

@MrLeeh, thanks for your help, I will try it out.

@akej74

This comment has been minimized.

Show comment
Hide comment
@akej74

akej74 Oct 4, 2016

Using pyinstaller --paths C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin test.py worked fine.

akej74 commented Oct 4, 2016

Using pyinstaller --paths C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin test.py worked fine.

@Tamriel

This comment has been minimized.

Show comment
Hide comment
@Tamriel

Tamriel Oct 6, 2016

On Mac, in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyQt5/Qt is no bin, only lib plugins qml translations 😞

Tamriel commented Oct 6, 2016

On Mac, in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyQt5/Qt is no bin, only lib plugins qml translations 😞

@NiklasRosenstein

This comment has been minimized.

Show comment
Hide comment
@NiklasRosenstein

NiklasRosenstein Dec 5, 2016

Contributor

It works for me using the Riverbank installer, but I have the same problem when using PyQt5 installed via Pip. Appending to PATH before running PyInstaller fixes finding the Qt DLLs

set PATH=%PATH%;C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin

Edit: Just noticed @akej74 and @MrLeeh mentioned pretty much the same thing above

But I still get a lot of these

...
36679 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5printsupport.dll
36744 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5printsupport.dll
40422 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40491 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40562 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40629 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40963 WARNING: lib not found: api-ms-win-crt-multibyte-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41029 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41094 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41165 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41230 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41296 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41363 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41428 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41493 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41559 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41624 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41690 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll

which is not the case when using the Riverbank installer.

Contributor

NiklasRosenstein commented Dec 5, 2016

It works for me using the Riverbank installer, but I have the same problem when using PyQt5 installed via Pip. Appending to PATH before running PyInstaller fixes finding the Qt DLLs

set PATH=%PATH%;C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin

Edit: Just noticed @akej74 and @MrLeeh mentioned pretty much the same thing above

But I still get a lot of these

...
36679 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5printsupport.dll
36744 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5printsupport.dll
40422 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40491 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40562 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40629 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
40963 WARNING: lib not found: api-ms-win-crt-multibyte-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41029 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41094 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41165 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41230 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41296 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41363 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41428 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41493 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41559 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41624 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
41690 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35-32\Lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll

which is not the case when using the Riverbank installer.

@NiklasRosenstein

This comment has been minimized.

Show comment
Hide comment
@NiklasRosenstein

NiklasRosenstein Dec 6, 2016

Contributor

For Mac OS, I found the shared libraries in

/usr/local/lib/python3.5/site-packages/PyQt5/

However, I still get

4039 ERROR: Can not find path ./QtCore.framework/Versions/5/QtCore (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/imageformats/libqgif.dylib)
4045 ERROR: Can not find path ./QtDBus.framework/Versions/5/QtDBus (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqoffscreen.dylib)
4045 ERROR: Can not find path ./QtGui.framework/Versions/5/QtGui (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqoffscreen.dylib)
4045 ERROR: Can not find path ./QtCore.framework/Versions/5/QtCore (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqoffscreen.dylib)
4050 ERROR: Can not find path ./QtGui.framework/Versions/5/QtGui (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/imageformats/libqdds.dylib)
...

These frameworks are in the Qt/lib folder of the aforementioned path, but adding it with --path doesn't fix it. Could it be that PyInstaller doesn't use this argument when searching for these frameworks?

Here the command-line I use

PYTHONPATH="$(PYTHONPATH)" $(PYINSTALLER) installer.spec -y \
	--path "/usr/local/lib/python3.5/site-packages/PyQt5/" \
	--path "/usr/local/lib/python3.5/site-packages/PyQt5/Qt/lib/" \
	--workpath "$(BUILD_DIR)/temp" --distpath "$(BUILD_DIR)/dist"
Contributor

NiklasRosenstein commented Dec 6, 2016

For Mac OS, I found the shared libraries in

/usr/local/lib/python3.5/site-packages/PyQt5/

However, I still get

4039 ERROR: Can not find path ./QtCore.framework/Versions/5/QtCore (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/imageformats/libqgif.dylib)
4045 ERROR: Can not find path ./QtDBus.framework/Versions/5/QtDBus (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqoffscreen.dylib)
4045 ERROR: Can not find path ./QtGui.framework/Versions/5/QtGui (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqoffscreen.dylib)
4045 ERROR: Can not find path ./QtCore.framework/Versions/5/QtCore (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqoffscreen.dylib)
4050 ERROR: Can not find path ./QtGui.framework/Versions/5/QtGui (needed by /usr/local/lib/python3.5/site-packages/PyQt5/Qt/plugins/imageformats/libqdds.dylib)
...

These frameworks are in the Qt/lib folder of the aforementioned path, but adding it with --path doesn't fix it. Could it be that PyInstaller doesn't use this argument when searching for these frameworks?

Here the command-line I use

PYTHONPATH="$(PYTHONPATH)" $(PYINSTALLER) installer.spec -y \
	--path "/usr/local/lib/python3.5/site-packages/PyQt5/" \
	--path "/usr/local/lib/python3.5/site-packages/PyQt5/Qt/lib/" \
	--workpath "$(BUILD_DIR)/temp" --distpath "$(BUILD_DIR)/dist"
@NiklasRosenstein

This comment has been minimized.

Show comment
Hide comment
@NiklasRosenstein

NiklasRosenstein Dec 6, 2016

Contributor

Nevermind, works on MacOS using the latest version from the develop branch: 3.3.dev0+g483c819.mod

Edit Without adding any --path argument

Contributor

NiklasRosenstein commented Dec 6, 2016

Nevermind, works on MacOS using the latest version from the develop branch: 3.3.dev0+g483c819.mod

Edit Without adding any --path argument

@tallforasmurf

This comment has been minimized.

Show comment
Hide comment
@tallforasmurf

tallforasmurf Dec 6, 2016

Contributor

confirm, windows fails with current dev tip but adding (in my case) --path=C:\Python35\Lib\site-packages\PyQt5\Qt\bin corrects it. Thanks @MrLeeh!

Contributor

tallforasmurf commented Dec 6, 2016

confirm, windows fails with current dev tip but adding (in my case) --path=C:\Python35\Lib\site-packages\PyQt5\Qt\bin corrects it. Thanks @MrLeeh!

@NiklasRosenstein

This comment has been minimized.

Show comment
Hide comment
@NiklasRosenstein

NiklasRosenstein Dec 7, 2016

Contributor

For some reason it just works now on Windows with PyInstaller 3.2 and a Riverbank install of PyQt5 5.5.1. No errors, no warnings. No need for --path. On Mac I still need the current dev tip.

Contributor

NiklasRosenstein commented Dec 7, 2016

For some reason it just works now on Windows with PyInstaller 3.2 and a Riverbank install of PyQt5 5.5.1. No errors, no warnings. No need for --path. On Mac I still need the current dev tip.

@AcidWeb

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb Jan 20, 2017

Still broken in v3.2.1

AcidWeb commented Jan 20, 2017

Still broken in v3.2.1

@Aens

This comment has been minimized.

Show comment
Hide comment
@Aens

Aens Jul 21, 2017

Windows 10, Python 3.5.3, pyinstaller 3.2.1 and PyQt5 5.9

I had 2 issues as well:

  • The first one (api-ms-win-crt... missing libs) got fixed by installing the Windows SDK with this comment instructions.
  • However the missing Qt5 dll files See screenshot are always missing and not bundled, no matter if I add --path=C:\Python35\Lib\site-packages\PyQt5\Qt\bin or not because that command seems to do absolutely nothing in this scenario. I manually navigated to that folder to confirm that those dlls exists there. I also added that path to the windows path just in case, but still no luck.

Is there any other workaround for it? I hope it gets fixed soon.

Edit: Tested it with cx_freeze and those dlls were automatically bundled without any issues, which confirms it's a pyinstaller thing.

Aens commented Jul 21, 2017

Windows 10, Python 3.5.3, pyinstaller 3.2.1 and PyQt5 5.9

I had 2 issues as well:

  • The first one (api-ms-win-crt... missing libs) got fixed by installing the Windows SDK with this comment instructions.
  • However the missing Qt5 dll files See screenshot are always missing and not bundled, no matter if I add --path=C:\Python35\Lib\site-packages\PyQt5\Qt\bin or not because that command seems to do absolutely nothing in this scenario. I manually navigated to that folder to confirm that those dlls exists there. I also added that path to the windows path just in case, but still no luck.

Is there any other workaround for it? I hope it gets fixed soon.

Edit: Tested it with cx_freeze and those dlls were automatically bundled without any issues, which confirms it's a pyinstaller thing.

@akej74

This comment has been minimized.

Show comment
Hide comment
@akej74

akej74 Aug 22, 2017

Hi, I did a new test with a simple QT application, using the following versions:

  • Python 3.6.2
  • PyQT 5.9 (installed with pip)
  • PyInstaller latest development (3.3.dev0+6ec718157) (installed with pip)

Packaging with the following command:
pyinstaller -w -n test_app main.py

Now, the three QT DLL´s (Qt5Core.dll, Qt5Gui.dll and Qt5Widgets.dll) are indeed included in the dist folder automatically, and the built application works. As far as I can see, this is now fixed, but maybe someone else would like to confirm?

As a bonus, everything works using Python 3.6 as well :-)

akej74 commented Aug 22, 2017

Hi, I did a new test with a simple QT application, using the following versions:

  • Python 3.6.2
  • PyQT 5.9 (installed with pip)
  • PyInstaller latest development (3.3.dev0+6ec718157) (installed with pip)

Packaging with the following command:
pyinstaller -w -n test_app main.py

Now, the three QT DLL´s (Qt5Core.dll, Qt5Gui.dll and Qt5Widgets.dll) are indeed included in the dist folder automatically, and the built application works. As far as I can see, this is now fixed, but maybe someone else would like to confirm?

As a bonus, everything works using Python 3.6 as well :-)

@AcidWeb

This comment has been minimized.

Show comment
Hide comment
@AcidWeb

AcidWeb Aug 22, 2017

I'm confirming that Python 3.6 + PyQT 5.9 + PyInstaller dev tip no longer require pathex modifications.

AcidWeb commented Aug 22, 2017

I'm confirming that Python 3.6 + PyQT 5.9 + PyInstaller dev tip no longer require pathex modifications.

@htgoebel

This comment has been minimized.

Show comment
Hide comment
@htgoebel

htgoebel Aug 22, 2017

Member

Thanks to testing.

Member

htgoebel commented Aug 22, 2017

Thanks to testing.

@htgoebel htgoebel closed this Aug 22, 2017

@htgoebel htgoebel added this to the PyInstaller 3.3 milestone Aug 22, 2017

@htgoebel htgoebel added the hooks label Aug 22, 2017

@luisiacc

This comment has been minimized.

Show comment
Hide comment
@luisiacc

luisiacc Nov 25, 2017

Python 3.6 + PyQt 5.9 + PyInstaller 3.3 ¡Works! , But just with the 64 bit version of Python 3.6.2, the 32bit version gave me the problem trated in 2241. Also the version that works make projects incredibly bigs, a little project bundled in a single file and it was 23mb, i think that s a lot, does someone has any tricks to make it smaller ?

Python 3.6 + PyQt 5.9 + PyInstaller 3.3 ¡Works! , But just with the 64 bit version of Python 3.6.2, the 32bit version gave me the problem trated in 2241. Also the version that works make projects incredibly bigs, a little project bundled in a single file and it was 23mb, i think that s a lot, does someone has any tricks to make it smaller ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment