Search code examples
pythonqtpyside2python-3.8

Installing PySide2 for Python 3.8, Windows


I would like to install PySide2 on my Windows 10, Python version 3.8, despite the wheels not being released for it yet.

Naturally, I have first tried the pip install --python-version 3.7 command to see if simply getting everything, but for the previous Python version, would be fine. It didn't work.

So instead I installed QT on my machine as well as every required dependency and tool to build it manually. I have progressed quite far and managed to successfully build shiboken2, but failed to build PySide2 itself.

The errors I keep getting are about missing DLL-s when trying to import shiboken2. Unfortunately, the output is rather unhelpful as it doesn't actually tell me which ones are missing, and I couldn't figure that out on my own.

The error from the manual building is as follows (nmake command in C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2 directory):

Scanning dependencies of target QtCore_pyi
Traceback (most recent call last):
  File "C:/PySide2/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 294, in <module>
    generate_all_pyi(outpath, options=options)
  File "C:/PySide2/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 251, in generate_all_pyi
    import PySide2
  File "C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2\PySide2\__init__.py", line 51, in <module>
    _setupQtDirectories()
  File "C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2\PySide2\__init__.py", line 21, in _setupQtDirectories
    import shiboken2
ImportError: DLL load failed while importing shiboken2: The specified module could not be found.

I would normally wait patiently until the wheels are released, but I can't find any information on the progress for Windows, and I know the library is available for Python3.8 on other platforms.

Do you recommend any steps to find out what's wrong with my build (I would normally use pip install for PySide2 so this is all new to me), or know how to solve the problem directly? I know shiboken2.cp38-win32.pyd is there and I've also included it in my PATH env var just in case, same for shiboken2.cp38-win32.dll - but these don't seem to be the missing files.

Note: Should this be a Super User question (?)


Solution

  • On Windows platform simple pip install PySide2 is not enough, you should make post-install steps. As part of PySide2 installation you got pywin32_postinstall.py script (Not sure about Win10, but on Windows 7 the path is C:\Users\<your_user>\AppData\Local\Programs\Python\Python38\Scripts\)

    You should run pywin32_postinstall.py -install to register DLLs.