Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyuic5 - ModuleNotFoundError: No module named PyQt5.sip

I have just installed Anaconda 5.2 with Python 3.6 on my windows system. Also installed pyqt5 and pyqt5-tools via pip with administrator privilege. Now when I run pyuic5.exe for converting ui files it shows following error:

Traceback (most recent call last):
  File "C:\Users\AshfaqurRahman\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "C:\Users\AshfaqurRahman\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "C:\Users\AshfaqurRahman\AppData\Roaming\Python\Python36\site-packages\PyQt5\uic\pyuic.py", line 26, in <module>
from PyQt5 import QtCore
ModuleNotFoundError: No module named 'PyQt5.sip'

I have tried installing PyQt5-sip package using pip. Buts its already installed in my system.

Why this problem is occurring? How can I solve this problem?

like image 855
Ashfaqur Rahaman Avatar asked Aug 12 '18 11:08

Ashfaqur Rahaman


2 Answers

According to Agile_Eagle's suggestion from the comments I just uninstalled pyqt5 and pyqt5-tools packages and the reinstalled them. Problem solved!

PS.: If you still got problems with PyQt, try uninstalling all of the PyQt related libraries:

pip uninstall PyQt5
pip uninstall PyQt5-sip
pip 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, then uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)

like image 173
Ashfaqur Rahaman Avatar answered Sep 21 '22 12:09

Ashfaqur Rahaman


As of June 2019, pyqt5-tools no longer exists. The solution I found was first installing pyqt5-sip and then install pyqt5

$ pip install pyqt5-sip

$ pip install pyqt5

This seems to get rid of the following error: ModuleNotFoundError: No module named 'PyQt5.sip'

like image 35
Heladio Amaya Avatar answered Sep 21 '22 12:09

Heladio Amaya