Search code examples
python-3.xuser-interfacepyqtpyqt4pyinstaller

"Failed to execute script pyi_rth_qt4plugins" error while running exe


I have made my application using PyQt4 and it's executable using pyinstaller. The executable runs fine on my system. My system also has PyQt5 installed.

The problem is that when I try to run the same executable on the target system(client's system), it gives me an error Failed to execute script pyi_rth_qt4plugins. The client system doesn't have Python or any version of PyQt.

I wanna know why is this happening. I'm not even able to locate where is the pyi_rth_qt4plugins located in the executable. Do I need to install Python and PyQt in my client's system as well?


Solution

  • As per the answer from the long thread here https://github.com/pyinstaller/pyinstaller/issues/2461

    In site-packages (where PyInstaller is located) edit the following file:

    PyInstaller/loader/rthooks.dat
    

    Remove this line:

    'PyQt4': ['pyi_rth_qt4plugins.py'],
    

    This error also occurs in Python3.5 if you are using 3.5 you can downgrade to 3.4 to avoid the error check here https://github.com/pyinstaller/pyinstaller/issues/2207

    or if you don't want to downgrade python you can upgrade to PyQt5