'PyQt5: ModuleNotFoundError: No module named 'PyQt5'

I have installed Python 3.7.1 and trying to run a form created using QTdesigner.But this error occurred.I have also installed PyQt5 module using

pip install PyQt5 

The error is:

from PyQt5 import QtCore, QtGui, QtWidgets   

ModuleNotFoundError: No module named 'PyQt5'


Solution 1:[1]

You can use pip3 to install a python3 module:

pip3 install PyQt5

Solution 2:[2]

Try this : Check your python directory correctly installed or Not. Go to the below a directory by cmd and run the commands.

C:\Users\PC_NAME\AppData\Local\Programs\Python\Python37-32\Scripts>

pip install PyQt5

your PRO.py program now ready to run successfully.

Solution 3:[3]

It seems like your pycharm is configured to use virtual environment. Try installing PyQt5 from pycharm terminal. It will install PyQt5 in your virtual environment and it fixed the issue in my case.

Solution 4:[4]

I had a similar error when starting with PyQT5. Do not know if this might answer your question but here was my scenario. I had both python 2.7 and python 3.7 on my machine. My pip 2.7 was added to the path instead of the 3.7. So i removed python 2.7 from the path, reinstalled python 3.7 and added to the path and restarted. After that used pip to install pyqt5 and it worked like a charm

Solution 5:[5]

i solved it by using python -m pip install PyQt5 on windows not pip install PyQt5

Solution 6:[6]

I have used all the below mentioned commands having done it with both VS terminal and cmd:

python -m pip install pyqt5
pip3 install pyqt5
python -m pip.py install pyqt5

Although it did install correctly but when I import PyQt5.QWidgets i get an error stating module not found. I am saying it did install correctly because when I run these commands again get a message "Requirements already satisfied".

Solution 7:[7]

For me the problem was solved by uninstalling the pip version and instead installing from apt:

pip3 uninstall PyQt5
sudo apt-get install python3-pyqt5

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Myrrkel
Solution 2
Solution 3 challenger15
Solution 4 Andrew Mine
Solution 5 Devjoseph
Solution 6 Rishav Raj
Solution 7 Philip Z.