PySide2: DLL load failed: The specified procedure could not be found

papers1010 picture papers1010 · Jun 25, 2019 · Viewed 7.6k times · Source

I am trying to build a project in PySide2 with Python 3.5.1. Previously, I was developing in PySide with Python 2.7 but wanted to upgrade to Python 3.

I have downloaded PySide2 (5.12.4) and I also have Qt5 (5.13.0) downloaded (if that matters).

However, whenever I try to run this hello world program, I keep getting these same exact errors, that I don't know where to start to fix.

I think the issue has to do with Shiboken but I have no idea how to fix it.

import sys
from PySide2.QtWidgets import QApplication, QDialog, QLineEdit, QPushButton

class Form(QDialog):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.setWindowTitle("My Form")

if __name__ == '__main__':
    # Create the Qt Application
    app = QApplication(sys.argv)
    # Create and show the form
    form = Form()
    form.show()
    # Run the main Qt loop
    sys.exit(app.exec_())

And my errors are:

Traceback (most recent call last):
  File "C:/Users/user1/Documents/program_folder/hello.py", line 2, in <module>
    from PySide2.QtWidgets import QApplication, QDialog, QLineEdit, QPushButton

  File "C:\Users\user1\venv\program_folder\lib\site-packages\PySide2\__init__.py", line 51, in <module>
    _setupQtDirectories()

  File "C:\Users\user1\venv\program_folder\lib\site-packages\PySide2\__init__.py", line 21, in _setupQtDirectories
    import shiboken2

  File "C:\Users\user1\venv\program_folder\lib\site-packages\shiboken2\__init__.py", line 27, in <module>
    from .shiboken2 import *

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

Answer

wedesoft picture wedesoft · Mar 24, 2020

Run pip freeze to get information about the installed versions and make sure that PySide2 and shiboken2 are of the same version.