I recently installed Python and Spyder in my computer, but Spyder doesn't start.
pip install spyder
python
import spyder; spyder.app.start.main()
Expected opening the GUI, but error occurred.
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'
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)
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
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.
I tried both approaches above:
Actually you need to uninstall it first:
pip uninstall pyqtwebengine
pip install pyqtwebengine
But I still get the same errors. This happens with ALL of my environments, base and 2 other different virtual environments I have tried. It seems to be a bad system-wide reference.
```(quantecon) c:\ProgramData\Anaconda3\envs\quantecon\Scripts>spyder
Traceback (most recent call last):
File "c:\ProgramData\Anaconda3\envs\quantecon\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in
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 "c:\ProgramData\Anaconda3\envs\quantecon\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "c:\ProgramData\Anaconda3\envs\quantecon\lib\site-packages\spyder\app\start.py", line 192, in main
from spyder.app import mainwindow
File "c:\ProgramData\Anaconda3\envs\quantecon\lib\site-packages\spyder\app\mainwindow.py", line 82, in
from qtpy import QtWebEngineWidgets # analysis:ignore
File "c:\ProgramData\Anaconda3\envs\quantecon\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'```
I need HELP with this one !! I don't want to reinstall Anaconda and re-build 6 or 7 different environments; that is too time consuming !!!
I am running the following environment right now:
(quantecon) c:\ProgramData\Anaconda3\envs\quantecon\Scripts>conda list
#
alabaster 0.7.12 py_0 conda-forge
arachnado 0.2 pypi_0 pypi
argh 0.26.2 py37_1001 conda-forge
asn1crypto 0.24.0 pypi_0 pypi
astroid 2.2.5 py37_0 conda-forge
atomicwrites 1.3.0 py_0 conda-forge
attrs 19.1.0 py_0 conda-forge
automat 0.7.0 pypi_0 pypi
autopep8 1.4.4 py_0 conda-forge
babel 2.7.0 py_0 conda-forge
backcall 0.1.0 py_0 conda-forge
blas 1.0 mkl
bleach 3.1.0 py_0 conda-forge
ca-certificates 2019.9.11 hecc5488_0 conda-forge
certifi 2019.6.16 py37_1 conda-forge
cffi 1.12.3 py37hb32ad35_0 conda-forge
chardet 3.0.4 pypi_0 pypi
cloudpickle 1.2.2 py_0 conda-forge
colorama 0.4.1 py_0 conda-forge
configparser 3.8.1 pypi_0 pypi
constantly 15.1.0 pypi_0 pypi
cryptography 2.7 py37hb32ad35_0 conda-forge
cssselect 1.1.0 pypi_0 pypi
cycler 0.10.0 py_1 conda-forge
decorator 4.4.0 py_0 conda-forge
defusedxml 0.5.0 py_1 conda-forge
diff-match-patch 20181111 py_0 conda-forge
docopt 0.6.2 pypi_0 pypi
docutils 0.15.2 py37_0 conda-forge
entrypoints 0.3 py37_1000 conda-forge
enum34 1.1.6 pypi_0 pypi
freetype 2.10.0 h563cfd7_1 conda-forge
future 0.17.1 py37_1000 conda-forge
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.
pip3 install PyQtWebEngine
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?
Is the issue related to this: https://stackoverflow.com/questions/37876987/cannot-import-qtwebkitwidgets-in-pyqt5 which would mean the version of pyqt5 getting installed is too new?
It seems like everytime I try to use spyder from a conda environment I get this error and I have to recreate the environment and install a specific version for spyder to work.
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 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
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
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
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
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.
@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
@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 have the same issue but can only install pyqtwebengine > 5.13
Most helpful comment
Actually you need to uninstall it first:
pip uninstall pyqtwebengine
pip install pyqtwebengine
This solved it for me.