matplotlib + pyside

Hi All,

I have tried the sample PySide code given at http://www.scipy.org/Cookbook/Matplotlib/PySide

the below excerpt is from my “Python Shell” for this sample code, which gives this error,

“ImportError: Warning: formlayout requires PyQt4 >v4.3”

It seems that it is looking for PyQt; but the whole point of using PySide is to avoid using PyQt.

Any help is appreciated.

– Armagan

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type “copyright”, “credits” or “license()” for more information.

import sys
import matplotlib
matplotlib.use(‘Qt4Agg’)
import pylab

Traceback (most recent call last):
File “<pyshell#3>”, line 1, in
import pylab
File “C:\Python27\lib\site-packages\pylab.py”, line 1, in
from matplotlib.pylab import *
File “C:\Python27\lib\site-packages\matplotlib\pylab.py”, line 263, in
from matplotlib.pyplot import *
File “C:\Python27\lib\site-packages\matplotlib\pyplot.py”, line 95, in
new_figure_manager, draw_if_interactive, show = pylab_setup()
File “C:\Python27\lib\site-packages\matplotlib\backends_init_.py”, line 25, in pylab_setup
globals(),locals(),[backend_name])
File “C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4agg.py”, line 12, in
from backend_qt4 import QtCore, QtGui, FigureManagerQT,
FigureCanvasQT,
File “C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py”, line 18, in
import matplotlib.backends.qt4_editor.figureoptions as figureoptions
File “C:\Python27\lib\site-packages\matplotlib\backends\qt4_editor\figureoptions.py”, line 11, in
import matplotlib.backends.qt4_editor.formlayout as formlayout
File “C:\Python27\lib\site-packages\matplotlib\backends\qt4_editor\formlayout.py”, line 51, in
raise ImportError, “Warning: formlayout requires PyQt4 >v4.3”
ImportError: Warning: formlayout requires PyQt4 >v4.3

···

Hi All,
I have tried the sample PySide code given at
http://www.scipy.org/Cookbook/Matplotlib/PySide
the below excerpt is from my "Python Shell" for this sample code, which
gives this error,

Github master works with pyside. It is expected to emerge as a release within a few weeks.

Eric

···

On 07/13/2011 09:18 PM, Armagan Tarim wrote:

"ImportError: Warning: formlayout requires PyQt4 >v4.3"
It seems that it is looking for PyQt; but the whole point of using
PySide is to avoid using PyQt.
Any help is appreciated.
-- Armagan
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import sys
>>> import matplotlib
>>> matplotlib.use('Qt4Agg')
>>> import pylab
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import pylab
File "C:\Python27\lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python27\lib\site-packages\matplotlib\pylab.py", line 263, in
<module>
from matplotlib.pyplot import *
File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 95, in
<module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py",
line 25, in pylab_setup
globals(),locals(),[backend_name])
File
"C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4agg.py",
line 12, in <module>
from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py",
line 18, in <module>
import matplotlib.backends.qt4_editor.figureoptions as figureoptions
File
"C:\Python27\lib\site-packages\matplotlib\backends\qt4_editor\figureoptions.py",
line 11, in <module>
import matplotlib.backends.qt4_editor.formlayout as formlayout
File
"C:\Python27\lib\site-packages\matplotlib\backends\qt4_editor\formlayout.py",
line 51, in <module>
raise ImportError, "Warning: formlayout requires PyQt4 >v4.3"
ImportError: Warning: formlayout requires PyQt4 >v4.3

-------------------------------------------------

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

As Eric said Github master works with PySide. If you can't wait for a release and you don't want to run the Github version of MPL you can use the following code to render a plot inside a PySide app. Note that this will just show the plot image. You won't get the tool bar, status bar or any other GUI elements.

Gerald.

pysideexample.py (1.14 KB)

···

On 14/07/2011 3:33 PM, Eric Firing wrote:

On 07/13/2011 09:18 PM, Armagan Tarim wrote:

Hi All,
I have tried the sample PySide code given at
http://www.scipy.org/Cookbook/Matplotlib/PySide
the below excerpt is from my "Python Shell" for this sample code, which
gives this error,

Github master works with pyside. It is expected to emerge as a release
within a few weeks.

Eric

"ImportError: Warning: formlayout requires PyQt4>v4.3"
It seems that it is looking for PyQt; but the whole point of using
PySide is to avoid using PyQt.
Any help is appreciated.
-- Armagan
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
  >>> import sys
  >>> import matplotlib
  >>> matplotlib.use('Qt4Agg')
  >>> import pylab
Traceback (most recent call last):
File "<pyshell#3>", line 1, in<module>
import pylab
File "C:\Python27\lib\site-packages\pylab.py", line 1, in<module>
from matplotlib.pylab import *
File "C:\Python27\lib\site-packages\matplotlib\pylab.py", line 263, in
<module>
from matplotlib.pyplot import *
File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 95, in
<module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py",
line 25, in pylab_setup
globals(),locals(),[backend_name])
File
"C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4agg.py",
line 12, in<module>
from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py",
line 18, in<module>
import matplotlib.backends.qt4_editor.figureoptions as figureoptions
File
"C:\Python27\lib\site-packages\matplotlib\backends\qt4_editor\figureoptions.py",
line 11, in<module>
import matplotlib.backends.qt4_editor.formlayout as formlayout
File
"C:\Python27\lib\site-packages\matplotlib\backends\qt4_editor\formlayout.py",
line 51, in<module>
raise ImportError, "Warning: formlayout requires PyQt4>v4.3"
ImportError: Warning: formlayout requires PyQt4>v4.3

-------------------------------------------------

Gerald, Eric, the code was very useful and run without any problem. many thanks for your help. – Armagan

···

Armagan Tarim
http://yunus.hacettepe.edu.tr/~armo/


From: Gerald Storer <gds@…3593…>
To: matplotlib-users@lists.sourceforge.net
Cc: armtar@…9…
Sent: Fri, July 15, 2011 5:47:34 AM
Subject: Re: [Matplotlib-users] matplotlib + pyside

As Eric said Github master works with PySide. If you can’t wait for a
release and you don’t want to run the Github version of MPL you can use
the following code to render a plot inside a PySide app. Note that this
will just show the plot image. You won’t get the tool bar, status bar
or any other GUI elements.

Gerald.