[PyQt] Problems building PyQt with Python 3.8.1 on Windows
Phil Thompson
phil at riverbankcomputing.com
Tue Feb 4 11:09:46 GMT 2020
On 04/02/2020 10:48, Boudewijn Rempt wrote:
> Hi,
>
> I embed Python and PyQt in my C++ application, Krita. Since I updated
> the
> version of Python from 3.6 to 3.8.1, PyQt doesn't get built correctly
> anymore. My version of Qt is 5.12.5 and I build Qt myself because it
> needs
> a lot of patching. The whole build system for the dependencies is setup
> using cmake external projects. I build using mingw 7.3.
>
> I build sip 4.19.21 with the following options ($PREFIX_ext_sip points
> to
> c:\dev\i_deps, the place where I install all dependencies when
> building):
>
> --platform win32-g++
> -b ${PREFIX_ext_sip}/bin
> -d ${PREFIX_ext_sip}/lib/krita-python-libs
> -e ${PREFIX_ext_sip}/include
> --sipdir ${PREFIX_ext_sip}/share/sip
> --target-py-version 3.8
> --sip-module PyQt5.sip
>
> I build PyQt 5.13.2 with the following options ($PREFIX_ext_pyqt also
> points to c:\dev\i_deps) :
>
> --confirm-license
> --target-py-version 3.8
> --bindir ${PREFIX_ext_pyqt}/bin
> --qt ${PREFIX_ext_pyqt}
> --qmake ${PREFIX_ext_pyqt}/bin/qmake.exe
> --sip ${PREFIX_ext_pyqt}/bin/sip.exe
> --sip-incdir ${PREFIX_ext_pyqt}/include
> --spec win32-g++
> --verbose
> --sipdir ${PREFIX_ext_pyqt}/share/sip
> --destdir ${PREFIX_ext_pyqt}/lib/krita-python-libs
> --stubsdir ${PREFIX_ext_pyqt}/lib/krita-python-libs/PyQt5
> --no-qml-plugin --no-python-dbus --no-qsci-api --no-tools
> --disable QtSql --disable QtTest --disable QtWinExtras
> --disable
> QtHelp
> --qmake ${PREFIX_ext_pyqt}/bin/qmake.exe
>
> I tried adding
>
> --assume-shared
> --link-full-dll
>
> But that doesn't make a difference.
>
> When I add the installation location of PyQt5 to PYTHONPATH and the
> location of the Qt dll's to PATH, and start Python manually and try to
> import PyQt5, PyQt5.Qt or PyQt5.sip, python doesn't complain. If I try
> to
> import any of the other modules, like QtCore or QtGui, python says it
> cannot find the module:
>
> c:\dev\krita>python
> Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916
> 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import PyQt5
>>>> import PyQt5.Qt
>>>> import PyQt5.QtCore
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: DLL load failed while importing QtCore: The specified
> module
> could not be found.
>
> However, the PyQt5 folder does contain all pyd and pyi files:
>
> c:\dev\b\ext_pyqt>explorer c:\dev\i_deps\bin
>
> c:\dev\b\ext_pyqt>dir c:\dev\i_deps\lib\krita-python-libs\PyQt5
> Volume in drive C is Windows
> Volume Serial Number is D4C3-2B56
>
> Directory of c:\dev\i_deps\lib\krita-python-libs\PyQt5
>
> 02/04/2020 10:08 AM <DIR> .
> 02/04/2020 10:08 AM <DIR> ..
> 02/04/2020 10:08 AM 15,872 Qt.pyd
> 02/04/2020 09:58 AM 3,244,544 QtCore.pyd
> 02/04/2020 09:55 AM 399,711 QtCore.pyi
> 02/04/2020 10:02 AM 3,274,240 QtGui.pyd
> 02/04/2020 09:55 AM 404,714 QtGui.pyi
> 02/04/2020 10:02 AM 735,232 QtMultimedia.pyd
> 02/04/2020 09:55 AM 86,315 QtMultimedia.pyi
> 02/04/2020 10:03 AM 154,624 QtMultimediaWidgets.pyd
> 02/04/2020 09:55 AM 4,672 QtMultimediaWidgets.pyi
> 02/04/2020 10:03 AM 935,936 QtNetwork.pyd
> 02/04/2020 09:55 AM 101,531 QtNetwork.pyi
> 02/04/2020 10:03 AM 158,208 QtOpenGL.pyd
> 02/04/2020 09:56 AM 15,984 QtOpenGL.pyi
> 02/04/2020 10:03 AM 340,992 QtPrintSupport.pyd
> 02/04/2020 09:56 AM 20,347 QtPrintSupport.pyi
> 02/04/2020 10:04 AM 808,448 QtQml.pyd
> 02/04/2020 09:56 AM 28,079 QtQml.pyi
> 02/04/2020 10:05 AM 1,534,976 QtQuick.pyd
> 02/04/2020 09:56 AM 63,260 QtQuick.pyi
> 02/04/2020 10:08 AM 75,776 QtQuickWidgets.pyd
> 02/04/2020 09:56 AM 4,790 QtQuickWidgets.pyi
> 02/04/2020 10:05 AM 140,800 QtSvg.pyd
> 02/04/2020 09:56 AM 6,053 QtSvg.pyi
> 02/04/2020 10:07 AM 6,849,024 QtWidgets.pyd
> 02/04/2020 09:56 AM 513,480 QtWidgets.pyi
> 02/04/2020 10:08 AM 293,376 QtXml.pyd
> 02/04/2020 09:56 AM 28,207 QtXml.pyi
> 02/03/2020 12:20 PM 116,736 sip.pyd
> 03/19/2019 02:25 PM 2,801 sip.pyi
> 02/04/2020 10:08 AM <DIR> uic
> 02/04/2020 10:08 AM 260,608 _QOpenGLFunctions_2_0.pyd
> 02/04/2020 10:08 AM 262,144 _QOpenGLFunctions_2_1.pyd
> 02/04/2020 10:08 AM 139,264 _QOpenGLFunctions_4_1_Core.pyd
> 03/19/2019 02:43 PM 826 __init__.py
> 02/04/2020 10:09 AM <DIR> __pycache__
> 33 File(s) 21,021,570 bytes
> 4 Dir(s) 65,477,173,248 bytes free
>
> I'm not sure what's going -- the way I build PyQt hasn't changed for
> ages
> and it used to work...
I'd start by using the standard DLL inspection tools (like Dependency
Walker) on QtCore.pyd to see what's missing.
Is the only change the version of Python?
Phil
More information about the PyQt
mailing list