Bug with matplotlib on WinPython-64bit-3.4.3.5Qt5

414 views
Skip to first unread message

Yuxiang Wang

unread,
Oct 29, 2015, 8:16:25 PM10/29/15
to WinPython
Environment:
Windows 7 64 bit
WinPython 64bit 3.4.3.5, Qt5

Code to repeat the bug:

# untitled0.py
import matplotlib.pyplot as plt

Output:

runfile('C:/temp/untitled0.py', wdir='C:/temp')
Traceback (most recent call last):

  File "<ipython-input-2-c036ec10656e>", line 1, in <module>
    runfile('C:/temp/untitled0.py', wdir='C:/temp')

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 786, in runfile
    execfile(filename, namespace)

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 87, in execfile
    exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

  File "C:/temp/untitled0.py", line 8, in <module>
    import matplotlib.pyplot as plt

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\matplotlib\pyplot.py", line 109, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 17, in <module>
    from .backend_qt5agg import NavigationToolbar2QTAgg

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 18, in <module>
    from .backend_qt5 import QtCore

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>
    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__

  File "X:\WinPython3\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\qt_compat.py", line 91, in <module>
    from PyQt4 import QtCore, QtGui

ImportError: No module named 'PyQt4'

stonebig

unread,
Oct 30, 2015, 2:38:34 AM10/30/15
to WinPython
Hi Yuxiang Wang,

Last version is  WinPython 64bit 3.4.3.6, since yesterday.

I don't seem to reproduce your issue with the new release, can you check ?

Maybe I misleaded you as I just noticed I mistaken pointed the "alternative download' link of the new realease to the older release.
(now fixed, but nothing is uploaded to github yet)


Yuxiang Wang

unread,
Oct 30, 2015, 3:18:15 PM10/30/15
to WinPython
Hi stonebig,

Thanks for responding! 

1. Yes... I was using the github releases, which is why I ended up using the older version (3.4.3.5).
2. I just tried the 3.4.3.6 but it still reports the same error:

In [1]: import matplotlib.pyplot as plt

Traceback (most recent call last):


File "<ipython-input-1-eff513f636fd>", line 1, in <module>

import matplotlib.pyplot as plt


File "X:\WinPython3Qt5\python-3.4.3.amd64\lib\site-packages\matplotlib\pyplot.py", line 114, in <module>

_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()


File "X:\WinPython3Qt5\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup

globals(),locals(),[backend_name],0)


File "X:\WinPython3Qt5\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 18, in <module>

from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase


File "X:\WinPython3Qt5\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 15, in <module>

from .backend_qt5 import QtCore


File "X:\WinPython3Qt5\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>

from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__


File "X:\WinPython3Qt5\python-3.4.3.amd64\lib\site-packages\matplotlib\backends\qt_compat.py", line 124, in <module>

from PyQt4 import QtCore, QtGui


ImportError: No module named 'PyQt4'


stonebig

unread,
Oct 30, 2015, 4:09:09 PM10/30/15
to WinPython
Hi again,

Could you put a screenshot on github or here, as I'm not sure I clearly understand your "experimental conditions" ?

There may be a conflict with your other distributions, or a system windows setting for Qt




stonebig

unread,
Oct 31, 2015, 6:01:03 AM10/31/15
to WinPython

you should have this

in [1]: !echo %QT_API%

pyqt5

Do you ?

Yuxiang Wang

unread,
Oct 31, 2015, 1:47:39 PM10/31/15
to WinPython
Dear stonebig,

Thanks again for responding!

1) I think I find something... Could you try to do the following to see whether you can reproduce this error?
Open spyder -> Tools -> Preferences -> IPython console -> Graphics -> Change the Backend from "Inline" to "Qt" -> restart spyder -> in the IPython QtConsole, enter `import matplotlib.pyplot as plt`

When I changed it back to "Inline", I see no error. This setting should be what brings up the issue.

2) A screenshot of how the error occured:


3) If I do `!echo %QT_API%` it does tell me it is pyqt5.


Shawn

stonebig

unread,
Oct 31, 2015, 1:59:54 PM10/31/15
to WinPython
ok,

Doing this change, you get in the".settings\.spyder-py3\spyder.ini file an ugly :
ets_backend = qt4

It looks like a spyder bug.

Yuxiang Wang

unread,
Oct 31, 2015, 2:02:06 PM10/31/15
to WinPython
Yes this is exactly it. Great catch stonebig! Thank you so much. I will post this to the spyder github issues.

Shawn

Yuxiang Wang

unread,
Oct 31, 2015, 2:07:50 PM10/31/15
to WinPython

stonebig

unread,
Oct 31, 2015, 2:20:53 PM10/31/15
to WinPython
ok,

Thanks for the reporting to Spyder team.
Reply all
Reply to author
Forward
0 new messages