Skip to content
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

Import error with new matplotib which uses PyQt5 #13

Open
dilawar opened this issue Apr 30, 2016 · 1 comment
Open

Import error with new matplotib which uses PyQt5 #13

dilawar opened this issue Apr 30, 2016 · 1 comment
Assignees

Comments

@dilawar
Copy link
Contributor

dilawar commented Apr 30, 2016

If python-matplotlib-qt5 or python-matplotlib-qtshared package is installed, moosegui won't launch. The trace-back is following:

Traceback (most recent call last):
  File "mgui.py", line 1194, in <module>
    main()
  File "mgui.py", line 1178, in main
    mWindow =  MWindow()
  File "mgui.py", line 177, in __init__
    self.setPlugin('default', '/')
  File "mgui.py", line 460, in setPlugin
    self.plugin = self.loadPluginClass(str(name))(str(root), self)
  File "mgui.py", line 412, in loadPluginClass
    pluginModule = self.loadPluginModule(name, re=re)
  File "mgui.py", line 364, in loadPluginModule
    module = imp.load_module(name, fp, pathname, description)
  File "/usr/lib/moose/gui/plugins/default.py", line 89, in <module>
    from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 18, in <module>
    from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 15, in <module>
    from .backend_qt5 import QtCore
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 27, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 17, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 58, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/qt_compat.py", line 114, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
RuntimeError: the PyQt5.QtCore module failed to register with the sip module

To fix it, make sure that matplotlib uses PyQt4 and an appropriate back-end is initialized. Otherwise you might run into following:

/usr/lib/python2.7/site-packages/moose/utils.py:35: UserWarning: Failed to importing plotting utilities: No module named backend_qt5agg
  warnings.warn("Failed to importing plotting utilities: %s" % e)
Traceback (most recent call last):
  File "mgui.py", line 1194, in <module>
    main()
  File "mgui.py", line 1178, in main
    mWindow =  MWindow()
  File "mgui.py", line 177, in __init__
    self.setPlugin('default', '/')
  File "mgui.py", line 460, in setPlugin
    self.plugin = self.loadPluginClass(str(name))(str(root), self)
  File "mgui.py", line 412, in loadPluginClass
    pluginModule = self.loadPluginModule(name, re=re)
  File "mgui.py", line 364, in loadPluginModule
    module = imp.load_module(name, fp, pathname, description)
  File "/usr/lib/moose/gui/plugins/default.py", line 89, in <module>
    from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
ImportError: No module named backend_qt4agg

It might need some attention before next release.

OS: OpenSuSE-Leap_42.1

@dilawar
Copy link
Contributor Author

dilawar commented Apr 30, 2016

Perhaps, it should best be handled at packaging level. If packages is installed, this should never happen. I should search for python-matplotlib-qt4 in dependency instead of python-matplotlib-qt.

If would be good, it gui can also use PyQt5. That would make packages more portable to newer versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant