Skip to content
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 · 21 comments
Closed

PyQT 5.7 DLLs are not bundled #2152

AcidWeb opened this issue Aug 20, 2016 · 21 comments
Labels
area:hooks Caused by or effecting some hook

Comments

@AcidWeb
Copy link

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
Copy link
Contributor

kz26 commented Aug 29, 2016

Can confirm. Copying the DLLs over works.

@akej74
Copy link

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
Copy link

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
Copy link

akej74 commented Sep 29, 2016

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

@akej74
Copy link

akej74 commented Oct 4, 2016

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

@Tamriel
Copy link

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
Copy link
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
Copy link
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
Copy link
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
Copy link
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!

@NiklasRosenstein
Copy link
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.

@AcidWeb
Copy link
Author

AcidWeb commented Jan 20, 2017

Still broken in v3.2.1

@Aens
Copy link

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
Copy link

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
Copy link
Author

AcidWeb commented Aug 22, 2017

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

@htgoebel
Copy link
Member

Thanks to testing.

@htgoebel htgoebel added this to the PyInstaller 3.3 milestone Aug 22, 2017
@htgoebel htgoebel added the area:hooks Caused by or effecting some hook label Aug 22, 2017
@luisiacc
Copy link

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 ?

@Overdrivr
Copy link

To complete @stlehmann answer, you can use the HOMEPATH variable (that is one of the available variables inside the spec file) to write the path to the binaries in a portable manner:

'venv\\Lib\\site-packages\\PyQt5\\Qt\\bin' becomes HOMEPATH + '\\PyQt5\\Qt\\bin'

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

@mithom
Copy link

mithom commented Mar 22, 2019

does this mean it is also solved for other libraries using dll's? like sounddevice and soundfile? i am using python 2.7 due to some constraints, so i can't test it.

@yyjkt
Copy link

yyjkt commented Jun 10, 2019

image

@FeralRobot
Copy link
Contributor

I'm getting the same library warnings as yyjkt commented June 10, 2019

If anyone has a recommendation for resolution, that would be great!

@pyinstaller pyinstaller locked as resolved and limited conversation to collaborators Sep 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:hooks Caused by or effecting some hook
Projects
None yet
Development

No branches or pull requests