I recently installed Python and Spyder in my computer, but Spyder doesn't start.
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)
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
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.
Gunz-katomaran, mherzog01, puruBHU, goncaloperes, minouHub, andre23arruda, Cibi075, lmaosimon, ostwalprasad, ilpapds, and 20 more reacted with thumbs up emoji
awaismirza92, brightauk, sakimarquis, ironcrypto, teast21, davircarvalho, and chrisdwells reacted with thumbs down emoji
rafaelvleite reacted with heart emoji
All reactions
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.
Traceback (most recent call last):
File "c:\ProgramData\Anaconda3\envs\quantecon\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 "c:\ProgramData\Anaconda3\envs\quantecon\Scripts\spyder-script.py", line 10, in <module>
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 <module>
from qtpy import QtWebEngineWidgets # analysis:ignore
File "c:\ProgramData\Anaconda3\envs\quantecon\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in <module>
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
# packages in environment at C:\ProgramData\Anaconda3\envs\quantecon:
# Name Version Build Channel
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.
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.
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 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?
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'
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
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
@ccordoba12 @systems-apatrick @JyotirmaySahu @jyk4100
Issue & (temporary) fix:
Yes. I had all the aforementioned troubles when I installed (in my virtual environment) the latest spyder (v5.3.2) with pip, but not the stable version that is also the highest permitted by conda (to date). I have the same spyder installed on my root, but with conda. As of today (on Linux), spyder v5.2.2 with pip install fetches PyQtWebEngine-5.12.1-5.12.10 and PyQt5-5.12.3-5.12.10. Spyder then launches without error. One can ignore the auto-start pop-up to update to v5.3.2.
Short synopsis:
The problem seems to be with pip-installing the latest spyder and/or pyqt5/pyqtwebengine. This needs fixing. Otherwise, using latest versions independent of conda won't be feasible. For now, I'd recommend sticking to the version permitted by conda (just search with conda search spyder, and install the latest allowed in that list with pip over your environment instead specific to your Python installation.)
I had the same problem except this time with spyder 5.2.2. After some tinkering I ended up with the identical command and now it works!
This was all because the input() command wasn't working on an old version.. :)
I was having similar problems while running spyder as GUI from Windows WSL.
Changing the pyqt5 versions/install/uninstall (pip install pyqt5=x.xx) and installing the libraries with following code worked for me.
sudo apt-get install libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libxtst-dev libxss-dev libdbus-1-dev libevent-dev libfontconfig1-dev libcap-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libegl1-mesa-dev gperf bison nodejs
refer to https://stackoverflow.com/questions/66607640/unable-to-import-qtwebenginepage-from-pyqt5-on-aws-linux
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.