Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1045

PySide2 cannot be embedded into MSVC2017 Qt application

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.3
    • Fix Version/s: None
    • Component/s: PySide
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      It's impossible to embed PySide2 into an application build against Qt 5.12.4 MSVC2017:

      PySide2 as installed with pip3 ships its own copy of the Qt dlls. Then within sources/pyside2/PySide2/_init_.py.in we run into:

      if sys.platform == 'win32':
              # PATH has to contain the package directory, otherwise plugins
              # won't be able to find their required Qt libraries (e.g. the
              # svg image plugin won't find Qt5Svg.dll).
              os.environ['PATH'] = pyside_package_dir + os.pathsep + os.environ['PATH']
      

      Now, if you try to embed PySide into a Qt application using a different ABI than whatever is shiped with PySide, you can run into quite opaque errors such as:

      ImportError: DLL load failed: The specified procedure could not be found.

      or:

      Exception thrown at 0x00007FF98554EB78 (ntdll.dll) in tst_python.exe: 0xC0000139: Entry Point Not Found.

      In our case this is happening because some Qt libraries where loaded already using the MSVC 2017 ABI and then others where tried to be loaded from the PySide2 folder, using whatever ABI gets shipped there.

      Using the VS debugger, I saw the following list of loaded libs at the point the exception is triggered:

      Qt5Test.dll     Qt5Test.dll     C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Test.dll N/A     Yes     Symbols loaded. C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Test.pdb 13      5.12.4.0        6/13/2019 5:41 AM    00007FF9670D0000-00007FF967112000       [11584] tst_python.exe
      Qt5Widgets.dll  Qt5Widgets.dll  C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Widgets.dll      N/A     Yes     Automatic symbol loading is disabled.           23      5.12.4.0        6/13/2019 5:40 AM    00007FF940900000-00007FF940E59000       [11584] tst_python.exe
      Qt5Gui.dll      Qt5Gui.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Gui.dll  N/A     Yes     Automatic symbol loading is disabled.           25      5.12.4.0        6/13/2019 5:36 AM   00007FF9402C0000-00007FF9408FF000        [11584] tst_python.exe
      Qt5Core.dll     Qt5Core.dll     C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Core.dll N/A     Yes     Automatic symbol loading is disabled.           27      5.12.4.0        6/13/2019 5:32 AM   00007FF93F460000-00007FF93FA49000        [11584] tst_python.exe
      Qt5Xml.dll      Qt5Xml.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Xml.dll  N/A     Yes     Automatic symbol loading is disabled.           42      5.12.4.0        6/13/2019 5:32 AM   00007FF966F30000-00007FF966F63000        [11584] tst_python.exe
      Qt5XmlPatterns.dll      Qt5XmlPatterns.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5XmlPatterns.dll  N/A     Yes     Automatic symbol loading is disabled.           43      5.12.4.0    6/13/2019 6:31 AM        0000000053770000-0000000053A9F000       [11584] tst_python.exe
      Qt5Network.dll  Qt5Network.dll  C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Network.dll      N/A     Yes     Automatic symbol loading is disabled.           60      5.12.4.0        6/13/2019 5:36 AM    00007FF951100000-00007FF951249000       [11584] tst_python.exe
      Qt5Qml.dll      Qt5Qml.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Qml.dll  N/A     Yes     Automatic symbol loading is disabled.           88      5.12.4.0        6/13/2019 6:23 AM   00007FF93F070000-00007FF93F45C000        [11584] tst_python.exe
      Qt5QuickWidgets.dll     Qt5QuickWidgets.dll     C:\Python36\Lib\site-packages\PySide2\Qt5QuickWidgets.dll       N/A     Yes     Automatic symbol loading is disabled.           103     5.12.4.0     6/27/2019 6:49 PM       00007FF968E60000-00007FF968E76000       [11584] tst_python.exe
      Qt5WebEngineWidgets.dll Qt5WebEngineWidgets.dll C:\Python36\Lib\site-packages\PySide2\Qt5WebEngineWidgets.dll   N/A     Yes     Automatic symbol loading is disabled.           104     5.12.4.0     6/27/2019 11:22 PM      00007FF962910000-00007FF96294C000       [11584] tst_python.exe
      Qt53DCore.dll   Qt53DCore.dll   C:\Python36\Lib\site-packages\PySide2\Qt53DCore.dll     N/A     Yes     Automatic symbol loading is disabled.           105     5.12.4.0        6/27/2019 7:03 PM    00007FF95A5A0000-00007FF95A600000       [11584] tst_python.exe
      Qt53DRender.dll Qt53DRender.dll C:\Python36\Lib\site-packages\PySide2\Qt53DRender.dll   N/A     Yes     Automatic symbol loading is disabled.           106     5.12.4.0        6/27/2019 7:07 PM    00007FF9416E0000-00007FF94190D000       [11584] tst_python.exe
      Qt5Quick.dll    Qt5Quick.dll    C:\Python36\Lib\site-packages\PySide2\Qt5Quick.dll      N/A     Yes     Automatic symbol loading is disabled.           109     5.12.4.0        6/27/2019 6:48 PM    00007FF93BDC0000-00007FF93C166000       [11584] tst_python.exe
      Qt5PrintSupport.dll     Qt5PrintSupport.dll     C:\Python36\Lib\site-packages\PySide2\Qt5PrintSupport.dll       N/A     Yes     Automatic symbol loading is disabled.           111     5.12.4.0     6/27/2019 12:52 AM      00007FF959580000-00007FF9595D2000       [11584] tst_python.exe
      Qt5WebEngineCore.dll    Qt5WebEngineCore.dll    C:\Python36\Lib\site-packages\PySide2\Qt5WebEngineCore.dll      N/A     Yes     Automatic symbol loading is disabled.           112     5.12.4.0     6/27/2019 11:06 PM      00007FF935FB0000-00007FF93AD29000       [11584] tst_python.exe
      Qt5Concurrent.dll       Qt5Concurrent.dll       C:\Python36\Lib\site-packages\PySide2\Qt5Concurrent.dll N/A     Yes     Automatic symbol loading is disabled.           113     5.12.4.0    6/27/2019 12:47 AM       00007FF97A7A0000-00007FF97A7AC000       [11584] tst_python.exe
       ~  clipboard  | grep Qt5
      Qt5Test.dll     Qt5Test.dll     C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Test.dll N/A     Yes     Symbols loaded. C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Test.pdb 13      5.12.4.0        6/13/2019 5:41 AM    00007FF9670D0000-00007FF967112000       [11584] tst_python.exe
      Qt5Widgets.dll  Qt5Widgets.dll  C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Widgets.dll      N/A     Yes     Automatic symbol loading is disabled.           23      5.12.4.0        6/13/2019 5:40 AM    00007FF940900000-00007FF940E59000       [11584] tst_python.exe
      Qt5Gui.dll      Qt5Gui.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Gui.dll  N/A     Yes     Automatic symbol loading is disabled.           25      5.12.4.0        6/13/2019 5:36 AM   00007FF9402C0000-00007FF9408FF000        [11584] tst_python.exe
      Qt5Core.dll     Qt5Core.dll     C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Core.dll N/A     Yes     Automatic symbol loading is disabled.           27      5.12.4.0        6/13/2019 5:32 AM   00007FF93F460000-00007FF93FA49000        [11584] tst_python.exe
      Qt5Xml.dll      Qt5Xml.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Xml.dll  N/A     Yes     Automatic symbol loading is disabled.           42      5.12.4.0        6/13/2019 5:32 AM   00007FF966F30000-00007FF966F63000        [11584] tst_python.exe
      Qt5XmlPatterns.dll      Qt5XmlPatterns.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5XmlPatterns.dll  N/A     Yes     Automatic symbol loading is disabled.           43      5.12.4.0    6/13/2019 6:31 AM        0000000053770000-0000000053A9F000       [11584] tst_python.exe
      Qt5Network.dll  Qt5Network.dll  C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Network.dll      N/A     Yes     Automatic symbol loading is disabled.           60      5.12.4.0        6/13/2019 5:36 AM    00007FF951100000-00007FF951249000       [11584] tst_python.exe
      Qt5Qml.dll      Qt5Qml.dll      C:\Qt-online\5.12.4\msvc2017_64\bin\Qt5Qml.dll  N/A     Yes     Automatic symbol loading is disabled.           88      5.12.4.0        6/13/2019 6:23 AM   00007FF93F070000-00007FF93F45C000        [11584] tst_python.exe
      Qt5QuickWidgets.dll     Qt5QuickWidgets.dll     C:\Python36\Lib\site-packages\PySide2\Qt5QuickWidgets.dll       N/A     Yes     Automatic symbol loading is disabled.           103     5.12.4.0     6/27/2019 6:49 PM       00007FF968E60000-00007FF968E76000       [11584] tst_python.exe
      Qt5WebEngineWidgets.dll Qt5WebEngineWidgets.dll C:\Python36\Lib\site-packages\PySide2\Qt5WebEngineWidgets.dll   N/A     Yes     Automatic symbol loading is disabled.           104     5.12.4.0     6/27/2019 11:22 PM      00007FF962910000-00007FF96294C000       [11584] tst_python.exe
      Qt53DCore.dll   Qt53DCore.dll   C:\Python36\Lib\site-packages\PySide2\Qt53DCore.dll     N/A     Yes     Automatic symbol loading is disabled.           105     5.12.4.0        6/27/2019 7:03 PM    00007FF95A5A0000-00007FF95A600000       [11584] tst_python.exe
      Qt53DRender.dll Qt53DRender.dll C:\Python36\Lib\site-packages\PySide2\Qt53DRender.dll   N/A     Yes     Automatic symbol loading is disabled.           106     5.12.4.0        6/27/2019 7:07 PM    00007FF9416E0000-00007FF94190D000       [11584] tst_python.exe
      Qt5Quick.dll    Qt5Quick.dll    C:\Python36\Lib\site-packages\PySide2\Qt5Quick.dll      N/A     Yes     Automatic symbol loading is disabled.           109     5.12.4.0        6/27/2019 6:48 PM    00007FF93BDC0000-00007FF93C166000       [11584] tst_python.exe
      Qt5PrintSupport.dll     Qt5PrintSupport.dll     C:\Python36\Lib\site-packages\PySide2\Qt5PrintSupport.dll       N/A     Yes     Automatic symbol loading is disabled.           111     5.12.4.0     6/27/2019 12:52 AM      00007FF959580000-00007FF9595D2000       [11584] tst_python.exe
      Qt5WebEngineCore.dll    Qt5WebEngineCore.dll    C:\Python36\Lib\site-packages\PySide2\Qt5WebEngineCore.dll      N/A     Yes     Automatic symbol loading is disabled.           112     5.12.4.0     6/27/2019 11:06 PM      00007FF935FB0000-00007FF93AD29000       [11584] tst_python.exe
      Qt5Concurrent.dll       Qt5Concurrent.dll       C:\Python36\Lib\site-packages\PySide2\Qt5Concurrent.dll N/A     Yes     Automatic symbol loading is disabled.           113     5.12.4.0    6/27/2019 12:47 AM       00007FF97A7A0000-00007FF97A7AC000       [11584] tst_python.exe
      

      From ProcMon.exe it looks like QtQuick is tried to be loaded but then loading QtQml fails - quite probably due to an ABI incompatibility.

      Possible solutions:

      • append instead of prepend to the PATH variable
      • make it possible to install pyside through MaintenanceTool

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              crmaurei Cristian Maureira-Fredes
              Reporter:
              milianw Milian Wolff
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes