I am guessing/suspecting that you don’t always run the Python
version you think you are running.
So, just to double check, if you do:
c:\Python26\python.exe
from PyQt4.QtGui import QFormLayout
You get no error?
‘file.py’ is your script which runs matplotlib, yes?
if above gives no error what happens if you do:
c:\Python26\python.exe file.py
Werner
···
Hi Antonio,
(forgot to copy list - for archive)
On 02/10/2013 17:05, António de Sousa wrote:
Hi Werner,
thank you for your reply.
Yes, the path is C:\Python26\lib\
Can it be that the error message is coming from a different
location?
Meaning that there may be duplicate files (e.g. python related
We were able to find the difference when installing Matplotlib via
Python(x,y) or as a separate package.
The difference is on paramater /backend/ on /matplotlibrc/ file.
/Python(x,y)-2.6.6.2.exe/ set the parameter to *Qt4Agg*
/matplotlib-1.0.1.win32-py2.6.exe/ sets the parameter to *TKAgg*
if backend : TKAgg
then the error
/ File
"C:\Python26\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/
Does not appear anymore.
Now looking how to use TKAgg without changing the matplotlibrc.
I've tried:
import matplotlib.pyplot as plt
plt.rcParams['backend'] = 'TkAgg'
Errr... no, don't do "import matplotlib as plt". That is just confusing.
To change backends, do the following:
import matplotlib
matplotlib.use("TkAgg")
Because backends are loaded upon import of matplotlib, changing the rcParam
after importing matplotlib is too late. You force a switch of the backend
via the "use()" function.
···
On Thu, Oct 3, 2013 at 6:35 AM, ajdcds <ajdcds@...32...> wrote:
Sorry, of course it does not work, the import is incorrect!
It should be
import matplotlib as plt
plt.rcParams['backend'] = 'TkAgg'
or simply
import matplotlib
matplotlib.rcParams['backend'] = 'TkAgg'