Merge lp:~russo79/mnemosyne-proj/force-matplotlib-pyqt4-backend into lp:~peter-bienstman/mnemosyne-proj/trunk

Proposed by Nuno Araujo
Status: Merged
Merge reported by: Peter Bienstman
Merged at revision: not available
Proposed branch: lp:~russo79/mnemosyne-proj/force-matplotlib-pyqt4-backend
Merge into: lp:~peter-bienstman/mnemosyne-proj/trunk
Diff against target: 13 lines (+3/-0)
1 file modified
mnemosyne/mnemosyne/pyqt_ui/statistics_wdgts_plotting.py (+3/-0)
To merge this branch: bzr merge lp:~russo79/mnemosyne-proj/force-matplotlib-pyqt4-backend
Reviewer Review Type Date Requested Status
Peter Bienstman Pending
Review via email: mp+233260@code.launchpad.net

Description of the change

  Force the usage of matplotlib PyQt4 backend

  matplotlib tries its backends on a given order
  The PyQt5 backend comes before the PyQt4 backend.

  On systems that have both backends installed, this caused a RuntimeError
  due to conflicting PyQt versions:

      An unexpected error has occurred.
      Please forward the following info to the developers:

      Traceback (innermost last):
      File "/usr/bin/mnemosyne", line 191, in <module>
      debug_file=options.debug_file)
      File "/usr/lib/python2.7/site-packages/mnemosyne/libmnemosyne/__init__.py", line 172, in initialise
      self.register_components()
      File "/usr/lib/python2.7/site-packages/mnemosyne/libmnemosyne/__init__.py", line 242, in register_components
      exec("from %s import %s" % (module_name, class_name))
      File "<string>", line 1, in <module>
      File "/usr/lib/python2.7/site-packages/mnemosyne/pyqt_ui/statistics_wdgts_plotting.py", line 9, in <module>
      from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
      File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 17, in <module>
      from .backend_qt5agg import NavigationToolbar2QTAgg
      File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 18, in <module>
      from .backend_qt5 import QtCore
      File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 28, in <module>
      import matplotlib.backends.qt_editor.figureoptions as figureoptions
      File "/usr/lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 17, in <module>
      import matplotlib.backends.qt_editor.formlayout as formlayout
      File "/usr/lib/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/lib/python2.7/site-packages/matplotlib/backends/qt_compat.py", line 91, in <module>
      from PyQt5 import QtCore, QtGui, QtWidgets
      RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap the QObject class

To post a comment you must log in.
Revision history for this message
Nuno Araujo (russo79) wrote :

I forgot to specify that this is only an issue since matplotlib-1.4.0

Revision history for this message
Peter Bienstman (peter-bienstman) wrote :

Thanks, I've added the patch to my tree.

Peter

> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Nuno Araujo
> Sent: 03 September 2014 22:22
> To: <email address hidden>
> Subject: [Merge] lp:~russo79/mnemosyne-proj/force-matplotlib-pyqt4-
> backend into lp:mnemosyne-proj
>
> Nuno Araujo has proposed merging lp:~russo79/mnemosyne-proj/force-
> matplotlib-pyqt4-backend into lp:mnemosyne-proj.
>
> Requested reviews:
> Peter Bienstman (peter-bienstman)
>
> For more details, see:
> https://code.launchpad.net/~russo79/mnemosyne-proj/force-matplotlib-
> pyqt4-backend/+merge/233260
>
> Force the usage of matplotlib PyQt4 backend
>
> matplotlib tries its backends on a given order
> The PyQt5 backend comes before the PyQt4 backend.
>
> On systems that have both backends installed, this caused a RuntimeError
> due to conflicting PyQt versions:
>
> An unexpected error has occurred.
> Please forward the following info to the developers:
>
> Traceback (innermost last):
> File "/usr/bin/mnemosyne", line 191, in <module>
> debug_file=options.debug_file)
> File "/usr/lib/python2.7/site-
> packages/mnemosyne/libmnemosyne/__init__.py", line 172, in initialise
> self.register_components()
> File "/usr/lib/python2.7/site-
> packages/mnemosyne/libmnemosyne/__init__.py", line 242, in
> register_components
> exec("from %s import %s" % (module_name, class_name))
> File "<string>", line 1, in <module>
> File "/usr/lib/python2.7/site-
> packages/mnemosyne/pyqt_ui/statistics_wdgts_plotting.py", line 9, in
> <module>
> from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
> FigureCanvas
> File "/usr/lib/python2.7/site-
> packages/matplotlib/backends/backend_qt4agg.py", line 17, in <module>
> from .backend_qt5agg import NavigationToolbar2QTAgg
> File "/usr/lib/python2.7/site-
> packages/matplotlib/backends/backend_qt5agg.py", line 18, in <module>
> from .backend_qt5 import QtCore
> File "/usr/lib/python2.7/site-
> packages/matplotlib/backends/backend_qt5.py", line 28, in <module>
> import matplotlib.backends.qt_editor.figureoptions as figureoptions
> File "/usr/lib/python2.7/site-
> packages/matplotlib/backends/qt_editor/figureoptions.py", line 17, in
> <module>
> import matplotlib.backends.qt_editor.formlayout as formlayout
> File "/usr/lib/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/lib/python2.7/site-
> packages/matplotlib/backends/qt_compat.py", line 91, in <module>
> from PyQt5 import QtCore, QtGui, QtWidgets
> RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap
> the QObject class
>
> --
> https://code.launchpad.net/~russo79/mnemosyne-proj/force-matplotlib-
> pyqt4-backend/+merge/233260
> You are requested to review the proposed merge of
> lp:~russo79/mnemosyne-proj/force-matplotlib-pyqt4-backend into
> lp:mnemosyne-proj.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mnemosyne/mnemosyne/pyqt_ui/statistics_wdgts_plotting.py'
2--- mnemosyne/mnemosyne/pyqt_ui/statistics_wdgts_plotting.py 2013-05-14 19:04:30 +0000
3+++ mnemosyne/mnemosyne/pyqt_ui/statistics_wdgts_plotting.py 2014-09-03 20:27:20 +0000
4@@ -4,6 +4,9 @@
5
6 from PyQt4 import QtGui
7
8+from matplotlib import use
9+use("Qt4Agg")
10+
11 from matplotlib import rcParams
12 from matplotlib.figure import Figure
13 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas

Subscribers

People subscribed via source and target branches