No longer able to launch Spyder since updating PyQt5 via pip

放肆的年华 提交于 2019-12-02 14:08:10

问题


Since updating my python3 packages via python3-pip on Ubuntu 18.04.2 LTS I am unable to launch spyder as it appears that the QtWebKitWidgets module of the PyQt5 package has been deprecated. The following console output is produced upon entering spyder3 in the terminal:

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

Has anyone else stumbled across this problem, and could anyone suggest a solution? I currently update my python3 packages via the following shell script:

#!/bin/sh

#================================#
#                                #
#### UPDATE PYTHON3 LIBRARIES ####
#                                #
#================================#

### Package List ###
# bs4 - web scraping
# keras - machine learning front end
# lifelines - survival analysis
# matplotlib - plots
# numpy - array-processing package
# pandas - data management
# scipy - open-source software for mathematics, science, and engineering
# seaborn - plots
# selenium - web scraping
# spyder - IDE
# statsmodels - basic statistical methods
# tensorflow - machine learning back end

PACKAGES='bs4 keras lifelines matplotlib numpy pandas scipy seaborn selenium spyder statsmodels tensorflow'

### Update via PIP3 ###
echo 'Updating packages ...'
pip3 install $PACKAGES --user --upgrade --upgrade-strategy="eager"
echo 'Update complete ...'

... and launch spyder using the following Gnome applications launcher link, located in ~/.local/share/applications:

[Desktop Entry]
Type=Application
Version=1.0
Name=Spyder3
GenericName=Spyder3
Comment=The Scientific Python Development Environment - Python 3
Icon=spyder3
TryExec=spyder3
Exec=spyder3 %F
Terminal=false
MimeType=text/x-python;
Categories=Development;Science;IDE;Qt;
Keywords=Development;Science;IDE;Qt;
StartupNotify=true
StartupWMClass=Spyder

回答1:


(Spyder maintainer here) To fix this problem you also need to install pyqtwebengine (besides pyqt5), like this

pip install pyqtwebengine

Note: We realized WebEngine was separated from PyQt5 only after we released our last version (3.3.3). But that's going to be fixed in our next one (3.3.4), to be released in March/2019.



来源:https://stackoverflow.com/questions/54943704/no-longer-able-to-launch-spyder-since-updating-pyqt5-via-pip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!