-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
I installed the latest version of anaconda which came with python 3.5.1 and matplotlib 1.5.1
Other software I am using:
- Windows 10
- Qt 5
- PyQt 5.6
With this setup the one line program below fails:
import matplotlib.pyplot as pltThe stack trace is shown below:
Traceback (most recent call last):
File "G:\reusable\junk.py", line 1, in <module>
import matplotlib.pyplot as plt
File "c:\anaconda3\lib\site-packages\matplotlib\pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "c:\anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "c:\anaconda3\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 18, in <module>
from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
File "c:\anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 15, in <module>
from .backend_qt5 import QtCore
File "c:\anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>
from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
File "c:\anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 124, in <module>
from PyQt4 import QtCore, QtGui
ImportError: cannot import name 'QtCore'
My best understanding of the stack trace is that in the QT 5 backend qt_compat.py is trying to import things from PyQt4 rather then PyQt5.
I figured out I can work around the crash by explicitly naming a backend like this:
import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as pltThis works for me but I suspect that the Qt 5 backend should not be trying to import PyQt4.
I attach a screenshot of the output of my debugger below.
https://cloud.githubusercontent.com/assets/4719098/15970896/f49b2d66-2f2e-11e6-8c5e-f8ace20343b3.png
The grey box contains the values of all the local variables at the time of the crash
I don't know if this is relevant but in the past I have installed then uninstalled:
- QT 4
- PyQt 4
- PySide