spyder: Spyder doesn't start - no module named 'PyQt5.QtWebEngineWidgets'

Problem Description

I recently installed Python and Spyder in my computer, but Spyder doesn’t start.

What steps reproduce the problem?

  1. Download and Install Python 3.7.2
  2. Open cmd
  3. pip install spyder
  4. python
  5. import spyder; spyder.app.start.main()

What is the expected output? What do you see instead?

Expected opening the GUI, but error occurred.

Paste Traceback/Error Below (if applicable)

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37\lib\site-packages\spyder\app\start.py", line 178, in main
    from spyder.app import mainwindow
  File "C:\Python37\lib\site-packages\spyder\app\mainwindow.py", line 90, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "C:\Python37\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

Versions

  • Spyder version: 3.3.3
  • Python version: 3.7.2 64-bit
  • Qt version: 5.10.0
  • PyQt version: 5.12
  • Operating System name/version: Windows 10

Dependencies

IPython >=4.0     :  7.2.0 (OK)
cython >=0.21     :  0.29.6 (OK)
jedi >=0.9.0      :  0.13.2 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
numpy >=1.7       :  1.15.4 (OK)
pandas >=0.13.1   :  0.24.1 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pyflakes >=0.6.0  :  2.1.0 (OK)
pygments >=2.0    :  2.3.1 (OK)
pylint >=0.25     :  2.2.2 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.8.3 (OK)
sympy >=0.7.3     :  1.3 (OK)

Solution

I managed to fix it, by installing an older version of PyQt5, following this discussion on Stack Overflow: https://stackoverflow.com/questions/51154871/python-3-7-0-no-module-named-pyqt5-qtwebenginewidgets

pip install PyQt5==5.10

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 12
  • Comments: 27 (2 by maintainers)

Most upvoted comments

Thanks for reporting. This is a duplicate of issue #8747 and it’ll be fixed in our next version (3.3.4).

For now you can run

pip install pyqtwebengine

to get the fix.

Actually you need to uninstall it first: pip uninstall pyqtwebengine pip install pyqtwebengine

This solved it for me.

First uninstall both PyQt5 and pyqtwebengine pip uninstall PyQt5 pip uninstall pyqtwebengine then install both pip install PyQt5==5.12.1 pyqtwebengine==5.12.1

pip3 install PyQtWebEngine

@ccordoba12

I tried both approaches above

By using pip to install PyQt5 you basically broke your Anaconda installation, so now you have to reinstall it. And please stick to the defaults packages (instead of using conda-forge) to see if that helps.

Thus, what is the installation to follow with conda? Only pip installation is provided, yet I cannot seem to find a conda install for PyQTWebEngine. Please advise.Thank you!

First uninstall both PyQt5 and pyqtwebengine pip uninstall PyQt5 pip uninstall pyqtwebengine then install both pip install PyQt5==5.12.1 pyqtwebengine==5.12.1

I keep having the same issue on WSL2 with latest anaconda3, a fresh environment, and the latest spyder version. when I follow the suggested pip uninstall pyqtwebengine pip install pyqtwebengine I get this:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spyder 5.0.2 requires pyqt5<5.13, but you have pyqt5 5.15.4 which is incompatible.
spyder 5.0.2 requires pyqtwebengine<5.13, but you have pyqtwebengine 5.15.4 which is incompatible.

Based on this error msg I tried pip uninstall pyqt5 pip install pyqt5==5.12 pyqtwebengine==5.12, which again gives me ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'.

Any suggestions?

I tried both approaches above

By using pip to install PyQt5 you basically broke your Anaconda installation, so now you have to reinstall it.

And please stick to the defaults packages (instead of using conda-forge) to see if that helps.

I just download the python 3.8 and pip install pyqt5 and PyQtWebEngine still get this issue how to solve it?

First uninstall both PyQt5 and pyqtwebengine pip uninstall PyQt5 pip uninstall pyqtwebengine then install both pip install PyQt5==5.12.3 pyqtwebengine==5.12.1

This solved the issue for spyder 5.2.2

I got past the first couple of potholes by installing as follows in my Anaconda 2020.02 base environment with Spyder v4.0.1 and Python 3.7.6:

pip install PyQt5==5.12.1 pyqtwebengine==5.12.1

I used 5.12.1 because of requisites for PyQt5<5.13 and pqtwebengine<5.13 reported on my attempt to install the latest version. This brought me to the following error message:

(base) Singularity> spyder Traceback (most recent call last): File “/usr/local/anaconda3/lib/python3.7/site-packages/qtpy/init.py”, line 204, in <module> from PySide import version as PYSIDE_VERSION # analysis:ignore ModuleNotFoundError: No module named ‘PySide’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/local/anaconda3/bin/spyder”, line 11, in <module> sys.exit(main()) File “/usr/local/anaconda3/lib/python3.7/site-packages/spyder/app/start.py”, line 201, in main from spyder.app import mainwindow File “/usr/local/anaconda3/lib/python3.7/site-packages/spyder/app/mainwindow.py”, line 52, in <module> requirements.check_qt() File “/usr/local/anaconda3/lib/python3.7/site-packages/spyder/requirements.py”, line 41, in check_qt import qtpy File “/usr/local/anaconda3/lib/python3.7/site-packages/qtpy/init.py”, line 210, in <module> raise PythonQtError(‘No Qt bindings could be found’) qtpy.PythonQtError: No Qt bindings could be found

At line 210, we have the following code:

if API in PYSIDE_API:
    try:
        from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
        from PySide.QtCore import __version__ as QT_VERSION  # analysis:ignore
        PYQT_VERSION = None
        PYQT5 = PYSIDE2 = False
        PYSIDE = True
    except ImportError:
        raise PythonQtError('No Qt bindings could be found')

The PySide 1.2.4 module is not compatible with Python version 3.7 (only up to 3.4), and installing PySide2 5.12.1 module does not resolve the binding issue, presumably because it would have to import PySide2, not PySide.

Problem Description

I recently installed Python and Spyder in my computer, but Spyder doesn’t start.

What steps reproduce the problem?

1. Download and Install Python 3.7.2

2. Open cmd

3. `pip install spyder`

4. `python`

5. `import spyder; spyder.app.start.main()`

What is the expected output? What do you see instead?

Expected opening the GUI, but error occurred.

Paste Traceback/Error Below (if applicable)

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37\lib\site-packages\spyder\app\start.py", line 178, in main
    from spyder.app import mainwindow
  File "C:\Python37\lib\site-packages\spyder\app\mainwindow.py", line 90, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "C:\Python37\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

Versions

* Spyder version: 3.3.3

* Python version: 3.7.2 64-bit

* Qt version: 5.10.0

* PyQt version: 5.12

* Operating System name/version: Windows 10

Dependencies

IPython >=4.0     :  7.2.0 (OK)
cython >=0.21     :  0.29.6 (OK)
jedi >=0.9.0      :  0.13.2 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
numpy >=1.7       :  1.15.4 (OK)
pandas >=0.13.1   :  0.24.1 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pyflakes >=0.6.0  :  2.1.0 (OK)
pygments >=2.0    :  2.3.1 (OK)
pylint >=0.25     :  2.2.2 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.8.3 (OK)
sympy >=0.7.3     :  1.3 (OK)

Solution

I managed to fix it, by installing an older version of PyQt5, following this discussion on Stack Overflow: https://stackoverflow.com/questions/51154871/python-3-7-0-no-module-named-pyqt5-qtwebenginewidgets

pip install PyQt5==5.10

This worked for me. Ubuntu 19.10 x86_64

I had the same problem while running spyder as GUI from Windows WSL.

pip list

PyQt5 5.15.7 PyQt5-Qt5 5.15.2 PyQt5-sip 12.11.0 PyQtWebEngine 5.15.6

Spyder doesn’t start - no module named ‘PyQt5.QtWebEngineWidgets’

Changing the pyqt5 versions by /uninstall new version /install old version:

pip uninstall PyQt5 Found existing installation: PyQt5 5.15.7 Uninstalling PyQt5-5.15.7: Successfully uninstalled PyQt5-5.15.7

pip uninstall PyQtWebEngine Found existing installation: PyQtWebEngine 5.15.6 Not uninstalling pyqtwebengine at /usr/lib/python3/dist-packages, outside environment /usr Can’t uninstall ‘PyQtWebEngine’. No files were found to uninstall.

pip install pyqt5==5.12.3 Installing collected packages: pyqt5 ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pyqtwebengine 5.15.6 requires PyQt5>=5.15.4, but you have pyqt5 5.12.3 which is incompatible. Successfully installed pyqt5-5.12.3

pip install sip==5.0.0 Successfully installed sip-5.0.0

pip install pyqt5==5.12.3 tools Successfully installed pytils-0.4.1 tools-0.1.9

pip install PyQtWebEngine==5.12.3 Successfully installed PyQtWebEngine-5.12.1

pip check No broken requirements found.

pip list PyQt5 5.12.3 PyQt5-Qt5 5.15.2 PyQt5-sip 12.11.0 PyQtWebEngine 5.12.1

Python 3.10.8 64-bit | Qt 5.12.10 | PyQt5 5.12.3 | Linux 5.15.68.1-microsoft-standard-WSL2 | Spyder 5.3.3

==================================

and now spyder run good.

pip uninstall PyQt5 pip uninstall pyqtwebengine

pip install PyQt5==5.12.1 pyqtwebengine==5.12.1

I tries above things. But I faild. and I see the next error.

Traceback (most recent call last): File “/home/withover/anaconda3/lib/python3.9/site-packages/qtpy/QtWebEngineWidgets.py”, line 22, in from PyQt5.QtWebEngineWidgets import QWebEnginePage ImportError: libXcursor.so.1: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/home/withover/anaconda3/bin/spyder”, line 11, in sys.exit(main()) File “/home/withover/anaconda3/lib/python3.9/site-packages/spyder/app/start.py”, line 233, in main from spyder.app import mainwindow File “/home/withover/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py”, line 59, in from qtpy import QtWebEngineWidgets # analysis:ignore File “/home/withover/anaconda3/lib/python3.9/site-packages/qtpy/QtWebEngineWidgets.py”, line 26, in from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage ModuleNotFoundError: No module named ‘PyQt5.QtWebKitWidgets’

I tried both approaches above

By using pip to install PyQt5 you basically broke your Anaconda installation, so now you have to reinstall it.

And please stick to the defaults packages (instead of using conda-forge) to see if that helps.