Search code examples
pythonqtimporterrorpyside2

ImportError while importing PySide2


I installed PySide2 using pip install PySide2

But i got this error when i tried to import it:

>>> import PySide2
PySide2/__init__.py: Unable to import shiboken2 from , C:\Users\ilia\AppData\Local\Programs\Python\Python38\Lib\idlelib, C:\Users\ilia\AppData\Local\Programs\Python\Python38\python38.zip, C:\Users\ilia\AppData\Local\Programs\Python\Python38\DLLs, C:\Users\ilia\AppData\Local\Programs\Python\Python38\lib, C:\Users\ilia\AppData\Local\Programs\Python\Python38, C:\Users\ilia\AppData\Roaming\Python\Python38\site-packages, C:\Users\ilia\AppData\Local\Programs\Python\Python38\lib\site-packages
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import PySide2
  File "C:\Users\ilia\AppData\Local\Programs\Python\Python38\lib\site-packages\PySide2\__init__.py", line 107, in <module>
    _setupQtDirectories()
  File "C:\Users\ilia\AppData\Local\Programs\Python\Python38\lib\site-packages\PySide2\__init__.py", line 58, in _setupQtDirectories
    import shiboken2
  File "C:\Users\ilia\AppData\Local\Programs\Python\Python38\lib\site-packages\shiboken2\__init__.py", line 27, in <module>
    from .shiboken2 import *
ImportError: DLL load failed while importing shiboken2: The specified procedure could not be found.
OS = Windows 10
python = 3.8.0
Pyside2 = 5.15.2
shiboken2 = 5.15.2

Solution

  • Have a look at the PyPI documentation here. If that doesn't help try to use

    pip show pyside2
    

    Make sure it is installede in your virtual environtment if you are using that and you are using the correct version of pip(3).

    Here is a person that is facing a similar problem.