Skip to content

No module named 'PyQt5.QtWebEngineWidgets' with anaconda on spyder 4.13 #12802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matheusfillipe opened this issue May 20, 2020 · 14 comments
Closed

Comments

@matheusfillipe
Copy link

matheusfillipe commented May 20, 2020

Procedure:
Fresh installed conda.

conda update anaconda
conda install spyder=4.1.3

Output:

$ /opt/anaconda/bin/spyder | xclip
Traceback (most recent call last):
  File "/opt/anaconda/lib/python3.7/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 "/opt/anaconda/bin/spyder", line 11, in <module>
    sys.exit(main())
  File "/opt/anaconda/lib/python3.7/site-packages/spyder/app/start.py", line 201, in main
    from spyder.app import mainwindow
  File "/opt/anaconda/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 84, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "/opt/anaconda/lib/python3.7/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

I do have python-pyqtwebengine installed on my system. I am running arch linux.
I a lso have python on my system but i already tried removing PyQt5 and pyqtwebengine using my system's pip and reinstalling and in both ways i always had this same missing QtWebEngine error.

I saw many errors like this on the issues here and they always end up like that's not a spyder problem, but maybe we need better installing instructions?

@ccordoba12
Copy link
Member

This is not issue with Spyder but with Anaconda. Please report it here:

https://github.com/ContinuumIO/anaconda-issues/issues/

@ccordoba12
Copy link
Member

I saw many errors like this on the issues here and they always end up like that's not a spyder problem, but maybe we need better installing instructions?

I don't think so (installing Anaconda is quite straightforward). People just need to avoid mixing pip, conda and system packages (as it seems you're doing).

@matheusfillipe
Copy link
Author

The fix for me was:
pip install PyQt5
Using the system wide pip and never run pip as root(pip for python 3, can be pip3 in some systems)
Then it still didn't work, then I reinstalled with:
pip uninstall PyQt5-sip
pip uninstall PyQt5
pip install PyQt5

All with the system python and it worked.

@MufaddalHamid
Copy link

Same problem but in windows 10 can someone help me solve it "No module named 'PyQt5.QtWebEngineWidgets'"

@dalthviz
Copy link
Member

Hi @MufaddalHamid please check our Troubleshooting Guide maybe something there could be useful :)

@bbutler3
Copy link

This issue is still happening for me. The Troubleshooting Guide did not help. I have tried installing various versions of PyQt5, and I always get errors.

@bbutler3
Copy link

I did a fresh install of Anaconda (latest version) on Ubuntu 20.4. The resultant error when I run Spyder directly after install:

~$ spyder
Traceback (most recent call last):
  File "/home/bbutler3/anaconda3/lib/python3.8/site-packages/qtpy/QtWebEngineWidgets.py", line 22, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: libXss.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/bbutler3/anaconda3/bin/spyder", line 11, in <module>
    sys.exit(main())
  File "/home/bbutler3/anaconda3/lib/python3.8/site-packages/spyder/app/start.py", line 201, in main
    from spyder.app import mainwindow
  File "/home/bbutler3/anaconda3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 84, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "/home/bbutler3/anaconda3/lib/python3.8/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

Please provide advice if possible.

@bbutler3
Copy link

I have solved my issue. Sorry for the multiple comments, but I want to help anyone else who may run into this. I think it was a Ubuntu libraries problem. After sudo apt-get install libxss1 to fix the ImportError, I got another one that was basically identical:
ImportError: libEGL.so.1: cannot open shared object file: No such file or directory
It took a little digging to find the right package this time, but I did sudo apt-get install libegl1-mesa, and Spyder worked after that! I'm using WSL 2 here, so I did have to fiddle with my X display settings, but that's a different issue. Anyway, I hope this helps anyone who may come looking, and saves the Spyder developers from more work in explaining.

@MufaddalHamid
Copy link

I solved my issue by getting fresh installation of python and anaconda i.e python 3.9 and anaconda 3

@mvazquezmassaro
Copy link

@bbutler3. I have the same problem!!! tried to fix it with your steps, but I can´t solve it :

Traceback (most recent call last):
File "/home/maxi/miniconda3/lib/python3.8/site-packages/qtpy/QtWebEngineWidgets.py", line 22, in
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: libQt5WebEngineWidgets.so.5: 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/maxi/miniconda3/bin/spyder", line 11, in
sys.exit(main())
File "/home/maxi/miniconda3/lib/python3.8/site-packages/spyder/app/start.py", line 208, in main
from spyder.app import mainwindow
File "/home/maxi/miniconda3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 84, in
from qtpy import QtWebEngineWidgets # analysis:ignore
File "/home/maxi/miniconda3/lib/python3.8/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

It´s Spyder 4.2.0....could you help me please!?

@ccordoba12
Copy link
Member

@mvazquezmassaro, that looks like an error in your installation. Please create a new environment and install Spyder on it, or remove and reinstall Miniconda again.

@rezwansk
Copy link

rezwansk commented Jun 30, 2022

pip uninstall pyqt5
then
pip install spyder
worked for me

@marles77
Copy link

To fix the problem with Spyder launching, install or update pyqtwebengine and then Spyder should work just fine (Anaconda 2.3.0, Spyder 5.3.3).

@ccordoba12
Copy link
Member

ccordoba12 commented Feb 20, 2023

I'm going to lock this issue because installing pyqt5 with pip, or related packages like pyqtwebengine, in Anaconda will break Spyder one way or another.

For future readers, if you're having a problem like this, you need to uninstall and reinstall Anaconda following the instructions in the second part of our video.

You also need to be very careful when using pip to install packages in Anaconda because pip and conda packages are binary incompatible (which is the source of this issue). That's also explained in the video I referenced above.

@spyder-ide spyder-ide locked as resolved and limited conversation to collaborators Feb 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants