michele
michele

Reputation: 26598

Python 3.7.0 No module named 'PyQt5.QtWebEngineWidgets'

I have Python 3.7.0 and I installed PyQt5 with this command:

pip install PyQt5

I have returned this error:

    main.py", line 4, in <module>
    from PyQt5.QtWebEngineWidgets import *
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

In Eclipse I have this configuration:

enter image description here

What may be wrong?

Thanks

Upvotes: 65

Views: 152832

Answers (6)

user21143871
user21143871

Reputation:

Run your terminal as administrator and install pyqt5 and PyQtWebEngine from there, it usually works if you are using anaconda for example and if not installing in your current env.

python -m pip install PyQt5
python -m pip install PyQtWebEngine

You may need to import your module and submodules depending on your code.

from PyQt5 import QtWebEngineWidgets
from PyQt5.QtWebEngineWidgets import *

from PyQt5 import QtWidgets
from PyQt5.QtWidgets import *

If it doesn't work try to push up your current env in the windows env config and try to reinstall pyqt5 .

enter image description here

Upvotes: 2

Avinash Raj
Avinash Raj

Reputation: 174776

For PyQt6, these packages needs to be installed.

PyQt6==6.5.0
PyQt6-Qt6==6.5.0
PyQt6-sip==13.5.0
PyQt6-WebEngine==6.5.0
PyQt6-WebEngine-Qt6==6.5.0

Upvotes: 1

Namgyal Brisson
Namgyal Brisson

Reputation: 1249

It has been moved to a separated package.

Based on this answer and my own experience, Just execute in a terminal:

pip install PyQtWebEngine

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, which should fix the following errors:

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

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 have upgraded your pip too.

# install latest python version for your operating system, then
# upgrade pip:
pip install --upgrade pip

# uninstall everything
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine

# install everything
pip install PyQt5
pip install PyQt5-sip
pip install PyQtWebEngine

Upvotes: 119

Devesh
Devesh

Reputation: 959

this is a problem with pyqt5. You can try:

pip install pyqt5==pyqt5.8

or same for conda

Upvotes: 3

wilk85
wilk85

Reputation: 65

I have just installed older version of pyqt5

pip install PyQt5==5.7.1

Upvotes: 3

Suedpol
Suedpol

Reputation: 101

For me, first uninstalling PyQtWebEngine with pip uninstall PyQtWebEngine and then reinstalling with pip install PyQtWebEngine solved the problem of Spyder not starting.

Upvotes: 10

Related Questions