hyperspy/hyperspyUI

Cannot load QtWebEngineWidgets

jinglong485 opened this issue · 4 comments

--- Things that should normally be included in a new issue: ---

I install hyperspyui with pyenv using pip. It works fine but the terminal pops up one error, the same error also happens in my windows machine.

Steps to reproduce

pip install hyperspy[all]
pip install hyperspyui
python -m hyperspyui

Error log

INFO:hyperspy.io_plugins.bruker:The fast cython based bcf unpacking library were found
INFO:hyperspy.io_plugins:The Signal2D (PIL) IO features are not available
DEBUG:hyperspyui:Loading HyperSpy signals...
DEBUG:hyperspyui:Initializing plugins
/Users/jinglong/.pyenv/versions/3.7.2/Python.framework/Versions/3.7/lib/python3.7/site-packages/hyperspyui/plugins/moviesaver.py:41: UserWarning: MovieWriter ffmpeg unavailable
warnings.warn("MovieWriter %s unavailable" % writer)
/Users/jinglong/.pyenv/versions/3.7.2/Python.framework/Versions/3.7/lib/python3.7/site-packages/hyperspyui/pluginmanager.py:130: RuntimeWarning: Exception in import of hyperspyui plugin "eelsdb" error:
ImportError: QtWebEngineWidgets must be imported before a QCoreApplication instance is created

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/jinglong/.pyenv/versions/3.7.2/Python.framework/Versions/3.7/lib/python3.7/site-packages/hyperspyui/pluginmanager.py", line 127, in discover
import('hyperspyui.plugins.' + plug, globals())
File "/Users/jinglong/.pyenv/versions/3.7.2/Python.framework/Versions/3.7/lib/python3.7/site-packages/hyperspyui/plugins/eelsdb.py", line 26, in
from qtpy import QtCore, QtNetwork, QtWidgets, QtWebEngineWidgets
File "/Users/jinglong/.pyenv/versions/3.7.2/Python.framework/Versions/3.7/lib/python3.7/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

self.warn("import", plug)
DEBUG:hyperspyui:Found plugins: [<class 'hyperspyui.plugins.align.AlignPlugin'>, <class 'hyperspyui.plugins.alignzlp.Alignzlp'>, <class 'hyperspyui.plugins.axesconf.AxesConf'>, <class 'hyperspyui.plugins.axesorderwidget.AxesOrderPlugin'>, <class 'hyperspyui.plugins.basicsignal.BasicSignalPlugin'>, <class 'hyperspyui.plugins.basicspectrum.BasicSpectrumPlugin'>, <class 'hyperspyui.plugins.cmappicker.CMapPickerPlugin'>, <class 'hyperspyui.plugins.croptool.CropToolPlugin'>, <class 'hyperspyui.plugins.dmannotations.DmAnnotations'>, <class 'hyperspyui.plugins.fft.FFT_Plugin'>, <class 'hyperspyui.plugins.fitting.FittingPlugin'>, <class 'hyperspyui.plugins.gaussianfilter.GaussianFilter'>, <class 'hyperspyui.plugins.imagerotation.ImageRotation_Plugin'>, <class 'hyperspyui.plugins.linemeasure.LineMeasure'>, <class 'hyperspyui.plugins.mva.MVA_Plugin'>, <class 'hyperspyui.plugins.metadataeditor.MetadataEditor'>, <class 'hyperspyui.plugins.mirrorplot.MirrorPlotPlugin'>, <class 'hyperspyui.plugins.moviesaver.MovieSaver'>, <class 'hyperspyui.plugins.plotutils.PlotUtils'>, <class 'hyperspyui.plugins.rebin.RebinPlugin'>, <class 'hyperspyui.plugins.recorderwidget.RecorderWidgetPlugin'>, <class 'hyperspyui.plugins.dataastext.SaveDataAsText'>, <class 'hyperspyui.plugins.segmentation.Segmentation'>, <class 'hyperspyui.plugins.stylesheet.StylePlugin'>, <class 'hyperspyui.plugins.tightlayout.Tightlayout'>, <class 'hyperspyui.plugins.gitgetter.GitSelector'>, <class 'hyperspyui.plugins.virtual_aperture.VirtualBfDf'>]
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.align.AlignPlugin'>
DEBUG:hyperspyui:Plugin loaded: Align
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.alignzlp.Alignzlp'>
DEBUG:hyperspyui:Plugin loaded: AlignZLP
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.axesconf.AxesConf'>
DEBUG:hyperspyui:Plugin loaded: Axes Configuration
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.axesorderwidget.AxesOrderPlugin'>
DEBUG:hyperspyui:Plugin loaded: Axes order widget
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.basicsignal.BasicSignalPlugin'>
DEBUG:hyperspyui:Plugin loaded: Basic signal tools
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.basicspectrum.BasicSpectrumPlugin'>
DEBUG:hyperspyui:Plugin loaded: Basic spectrum tools
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.cmappicker.CMapPickerPlugin'>
DEBUG:hyperspyui:Plugin loaded: Color map picker
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.croptool.CropToolPlugin'>
DEBUG:hyperspyui:Plugin loaded: Crop tool
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.dmannotations.DmAnnotations'>
DEBUG:hyperspyui:Plugin loaded: DM Annotations
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.fft.FFT_Plugin'>
DEBUG:hyperspyui:Plugin loaded: FFT
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.fitting.FittingPlugin'>
DEBUG:hyperspyui:Plugin loaded: Fitting plugin
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.gaussianfilter.GaussianFilter'>
DEBUG:hyperspyui:Plugin loaded: Gaussian Filter
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.imagerotation.ImageRotation_Plugin'>
DEBUG:hyperspyui:Plugin loaded: Image Rotation
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.linemeasure.LineMeasure'>
DEBUG:hyperspyui:Plugin loaded: LineMeasure
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.mva.MVA_Plugin'>
DEBUG:hyperspyui:Plugin loaded: MVA
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.metadataeditor.MetadataEditor'>
DEBUG:hyperspyui:Plugin loaded: Metadata Editor
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.mirrorplot.MirrorPlotPlugin'>
DEBUG:hyperspyui:Plugin loaded: Mirror plot
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.moviesaver.MovieSaver'>
DEBUG:hyperspyui:Plugin loaded: Movie Saver
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.plotutils.PlotUtils'>
DEBUG:hyperspyui:Plugin loaded: Plot utils
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.rebin.RebinPlugin'>
DEBUG:hyperspyui:Plugin loaded: Rebin
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.recorderwidget.RecorderWidgetPlugin'>
DEBUG:hyperspyui:Plugin loaded: Recorder Widget
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.dataastext.SaveDataAsText'>
DEBUG:hyperspyui:Plugin loaded: Save data as text
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.segmentation.Segmentation'>
DEBUG:hyperspyui:Plugin loaded: Segmentation
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.stylesheet.StylePlugin'>
DEBUG:hyperspyui:Plugin loaded: Style
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.tightlayout.Tightlayout'>
DEBUG:hyperspyui:Plugin loaded: TightLayout
DEBUG:hyperspyui:Initializing plugin: <class 'hyperspyui.plugins.virtual_aperture.VirtualBfDf'>
DEBUG:hyperspyui:Plugin loaded: Virtual BF/DF
DEBUG:hyperspyui:Creating default actions
DEBUG:hyperspyui:Creating plugin actions
DEBUG:hyperspyui:Creating console
DEBUG:hyperspyui:Creating menus
DEBUG:hyperspyui:Creating toolbars
DEBUG:hyperspyui:Creating widgets
INFO:hyperspyui:Main window loaded!

Also when I load dm4 file it rises error as following, this error can be repeated on Windows with same error.
Traceback (most recent call last):
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspyui/mainwindowhyperspy.py", line 527, in load
sig.plot()
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/_signals/signal2d.py", line 324, in plot
**kwargs
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspyui/hooksignal.py", line 33, in plot
r = super(HookedSignal, self).plot(*args, **kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/signal.py", line 2077, in plot
self._plot.plot(**kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/drawing/mpl_he.py", line 176, in plot
self.plot_signal(**kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/drawing/mpl_hie.py", line 91, in plot_signal
imf.plot(**kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/drawing/image.py", line 258, in plot
self.create_figure()
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/drawing/image.py", line 240, in create_figure
super().create_figure(**kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/drawing/figure.py", line 57, in create_figure
else None, **kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspy/drawing/utils.py", line 130, in create_figure
fig = plt.figure(**kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 539, in figure
**kwargs)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspyui/mdi_mpl_backend.py", line 132, in new_figure_manager
return new_figure_manager_given_figure(num, thisFig)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/hyperspyui/mdi_mpl_backend.py", line 140, in new_figure_manager_given_figure
canvas = FigureCanvas(figure)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 21, in init
super().init(figure=figure)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py", line 226, in init
super().init(figure=figure)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1582, in init
self._fix_ipython_backend2gui()
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1629, in _fix_ipython_backend2gui
ip.enable_matplotlib()
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/ipykernel/inprocess/ipkernel.py", line 183, in enable_matplotlib
return super(InProcessInteractiveShell, self).enable_matplotlib(gui)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3384, in enable_matplotlib
pt.activate_matplotlib(backend)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/IPython/core/pylabtools.py", line 314, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "/Users/jinglong/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 230, in switch_backend
newbackend, required_framework, current_framework))
ImportError: Cannot load backend 'Qt4Agg' which requires the 'qt4' interactive framework, as 'qt5' is currently running

My pip list is as following:

Package Version


appnope 0.1.0
attrs 19.1.0
autopep8 1.4.4
backcall 0.1.0
bleach 3.1.0
blosc 1.8.1
certifi 2019.6.16
chardet 3.0.4
cycler 0.10.0
Cython 0.29.10
dask 1.2.2
decorator 4.4.0
defusedxml 0.6.0
dill 0.2.9
docutils 0.14
entrypoints 0.3
future 0.17.1
h5py 2.9.0
hyperspy 1.4.2
hyperspy-gui-ipywidgets 1.1.1
hyperspy-gui-traitsui 1.1.1
hyperspyUI 1.1.0
idna 2.8
imageio 2.5.0
ipykernel 5.1.1
ipyparallel 6.2.4
ipython 7.5.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.14.0
Jinja2 2.10.1
joblib 0.13.2
jsonschema 3.0.1
jupyter-client 5.2.4
jupyter-core 4.5.0
kiwisolver 1.1.0
link-traits 1.0.2
llvmlite 0.29.0
MarkupSafe 1.1.1
matplotlib 3.1.0
mistune 0.8.4
mpmath 1.1.0
mrcz 0.5.2
natsort 6.0.0
nbconvert 5.5.0
nbformat 4.4.0
networkx 2.3
notebook 5.7.8
numba 0.44.1
numexpr 2.6.9
numpy 1.16.4
pandas 0.24.2
pandocfilters 1.4.2
parso 0.5.0
patsy 0.5.1
pexpect 4.7.0
pickleshare 0.7.5
Pillow 6.0.0
Pint 0.9
pip 19.1.1
prometheus-client 0.7.1
prompt-toolkit 2.0.9
ptyprocess 0.6.0
pycodestyle 2.5.0
pyface 6.1.1
pyflakes 2.1.1
Pygments 2.4.2
pyparsing 2.4.0
pyqode.core 2.12.0
pyqode.python 2.12.0
pyqode.qt 2.10.0
PyQt5 5.12.2
PyQt5-sip 4.19.17
PyQtWebEngine 5.12.1
pyrsistent 0.15.2
python-dateutil 2.8.0
pytz 2019.1
PyWavelets 1.0.3
pyzmq 18.0.1
qtconsole 4.5.1
QtPy 1.8.0
requests 2.22.0
scikit-image 0.15.0
scikit-learn 0.21.2
scipy 1.3.0
Send2Trash 1.5.0
setuptools 40.8.0
six 1.12.0
sparse 0.7.0
statsmodels 0.10.0
sympy 1.4
terminado 0.8.2
testpath 0.4.2
toolz 0.9.0
tornado 6.0.3
tqdm 4.32.2
traitlets 4.3.2
traits 5.1.1
traitsui 6.1.1
urllib3 1.25.3
wcwidth 0.1.7
webencodings 0.5.1
widgetsnbextension 3.4.2

The QtWebEngineWidgets is pyqt API change and it will only affect the EELS database browser. It has been a while and we should fix it at some point....

The second issue is due to the last matplotlib release and this is now fixed in #179 and #181. In the mean time you can downgrade matplotlib to 3.0.*

Thank you!