No module named PyQt5.sip No module named PyQt5.sip python-3.x python-3.x

No module named PyQt5.sip


The reason is a backward incompatible change in PyQt-5.11

In geoptics this fix works on old and new versions:

try:    # new location for sip    # https://www.riverbankcomputing.com/static/Docs/PyQt5/incompatibilities.html#pyqt-v5-11    from PyQt5 import sipexcept ImportError:    import sip


As suggested here pyuic5 - ModuleNotFoundError: No module named PyQt5.sip

Try uninstalling and re-installing all PyQt related libraries:

pip uninstall PyQt5pip uninstall PyQt5-sippip uninstall PyQtWebEngine

Then install them again, this will fix:

ModuleNotFoundError: No module named 'PyQt5.sip'ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python<PYTHON-VERSION>\Lib\site-packages and manually delete the PyQt folders, them uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)


If you're building sip and PyQt5 from source using make files, make sure to check PyQt5 install docs. In particular,

Note

When building PyQt5 v5.11 or later you must configure SIP to create a private copy of the sip module using a command line similar to the following:

python configure.py --sip-module PyQt5.sip

If you already have SIP installed and you just want to build and install the private copy of the module then add the --no-tools option.