[PyQt] PyQt5 for Python 2.7 on Windows 10

Nathan Warmerdam nbwarmerdam at integrated-informatics.com
Wed May 31 18:40:00 BST 2017


Hi Phil,

We have a commercial license of Qt.  On our build machine (windows 8.1 with VS 2015) I did the following:
- Installed Qt 5.8 (msvc2015) 
- pulled down the PyQT5 5.8.2 Commercial source code 
- sip 4.19.2. source code

I then successfully built sip and PyQt5 for python 2.7.  In an effort to make my build of PyQt5 independent of a Qt install I did the following:
- Copy the relevant qt dlls to a sub folder PyQt5/Qt/bin
- Copy the relevant qt plugins and qml files to PyQt5/Qt/plugins and PyQt5/Qt/qml respectively
- Copy the windows redistributables (concrt140.dll, msvcp140.dll, vccorlib140.dll, vcruntime140.dll) to PyQt5/Qt/bin
- Create a qt.conf in the bin folder that contains just:
[Paths]
Prefix = ..
- Modified PyQt5 __init__.py per my original email.

I took this PyQt5 folder over to a separate “clean” machine (no Qt installed, no PyQt soruce code) with python 2.7 installed and tested that it worked (the dependency had been broken).   My tests were successful on this test machine which happened to also be Windows 8.1.  I actually tested it on numerous clean Windows 8.1 machines with no trouble.
I then dropped this package onto a Windows 10 machine and ran my tests and that is when I ran into this problem.

The only reason I adopted the PyQt5/Qt/.. structure is because I noted that this is what the PyQt5 Python 3 GPL version appears to do when installed by pip.  I had hoped there was some magic to that setup.

The internet has given me the impression that this particular message only pops up when Qt is unable to find the qwindows.dll in the plugins\platforms\windows folder however my attempts at rectifying this via the qt.conf have been unsuccessful.

Thank you.
Nathan

On 5/31/17, 12:39 AM, "Phil Thompson" <phil at riverbankcomputing.com> wrote:

    On 31 May 2017, at 1:30 am, Nathan Warmerdam <nbwarmerdam at integrated-informatics.com> wrote:
    > 
    > Hello All,
    >  
    > I have built (with commercial license) PyQt5 for python 2.7.  I used VS 2015 and packaged my build with what I believe to be the appropriate windows redistributables.
    >  
    > With the resulting build I have had success getting it to run on an independent (i.e. not the build machine) Windows 8.1 machine. 
    >  
    > However when attempting to get it to run on a Windows 10 I have run into the dreaded:
    > This application failed to start because it could not find or load the Qt platform plugin “windows”
    >  
    > This is usually a sign that the qt.conf is bad but why would it work on Windows 8 but not Windows 10?  Furthermore it does not work even if I put a qt.conf file right next to the python.exe.
    >  
    > I have followed the file structure used by Phil in the Python 3 version of PyQt5 (e.g. PyQt5\Qt\bin and PyQt5\plugins, etc) and modified the __init__.py file to set various environment variables.  Like this:
    >  
    > import os
    > import sys
    > dir_name = os.path.dirname(__file__)
    >  
    > _path = os.path.dirname(__file__) + '\\Qt\\bin;' + os.environ['PATH']
    > os.environ['PATH'] = _path
    >  
    > os.environ['QML_IMPORT_PATH'] = os.path.join(dir_name, 'Qt', 'qml')
    > os.environ['QML2_IMPORT_PATH'] = os.path.join(dir_name, 'Qt', 'qml')
    >  
    > os.environ['QT_PLUGIN_PATH'] = os.path.join(dir_name, 'Qt', 'plugins')
    >  
    > os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = os.path.join(dir_name, 'Qt', 'plugins', 'platforms')
    >  
    > However the message persists.
    >  
    > As I said, it works on independent Windows 8.1 machines but not with Windows 10.  Does anyone have any tips or experience or success with PyQt5 for python 2.7 on Windows 10?
    
    I'm not sure why you are adopting that file structure. Is that structure working on Windows 8? How have you built/installed Qt?
    
    Phil
    
    



More information about the PyQt mailing list