pyuic5 – ModuleNotFoundError: No module named PyQt5.sip

Question:

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:UsersAshfaqurRahmanAnaconda3librunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "C:UsersAshfaqurRahmanAnaconda3librunpy.py", line 85, in _run_code
exec(code, run_globals)
  File "C:UsersAshfaqurRahmanAppDataRoamingPythonPython36site-packagesPyQt5uicpyuic.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?

Asked By: Ashfaqur Rahaman

||

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>AppDataLocalProgramsPythonPython<PYTHON-VERSION>Libsite-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)

Answered By: Ashfaqur Rahaman

I am a Mac user and I had faced a similar issue.
However, I understand for window users, what you are looking for is pyuic5.bat and not pyuic5.sip
It seems you’ll simply have to provide the full path of the pyuic file(for me, it was under a hidden folder usr in the home directory: /usr/local/Cellar/pyqt/5.10.1_1/bin/pyuic5) and do make sure on your terminal(for you, cmd) you have the directory changed to where the *.ui file lies which you wish to convert to a *.py file.

So for instance, if you have a Qt designer file saved by the name untitled.ui on your desktop, put in the following command in your terminal:

Amars-MacBook-Pro:Desktop amaradak$ /usr/local/Cellar/pyqt/5.10.1_1/bin/pyuic5 -x untitled.ui -o untitled.py

Hope this helps…
Cheers

Answered By: amar adak

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'

Answered By: Heladio Amaya

None of the answers above worked for PyQt5 5.13.0 on conda’s python 3.6.

With pyqt5 and pyqt5-sip installed just go into python’s site-packages and copy sip.so from the PyQt5_sip package to PyQt5 folder (or make a symlink) where the rest of Qt’s so modules are.

Seems like a poor decision to pull sip out into a separate package.

Answered By: frmdstryr

I am also a MAC user, but found adding the code below fixed my problem with "no module named sip":

from PyQt5.QtCore import QCoreApplication

Answered By: Richard Bump

On windows py3.10 with fresh venv it’s throwing `No module named ‘PyQt5.sip’.

pyqt5-sip is at version 12.9.1. After updating it (pip install pyqt5-sip -U) to version 12.11.0 it isn’t throwing anymore.

Answered By: Erik Kokalj
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.