[pdfgui bug] Still wants to call pylab before matplotlib.use

14 views
Skip to first unread message

dif...@diffpy.org

unread,
Mar 16, 2009, 8:31:59 PM3/16/09
to diffp...@googlegroups.com
reporter: jessica.k...@gmail.com

summary: Still wants to call pylab before matplotlib.use

description: I've just installed the prereleased version of pdfgui and this error is still coming up even though the code in extendedplotframe.py was already correct.

component: pdfgui

version: 1.0c1.dev-r2837-20090310

traceback:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/gui/errorwrapper.py", line 60, in _f
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/gui/plotpanel.py", line 207, in updateWidgets
self._check(None)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/gui/plotpanel.py", line 268, in _check
self._plot(None)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/gui/plotpanel.py", line 245, in _plot
self.mainFrame.control.plot(xval, yvals, refs, shift=offset, dry=(event is None))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/control/pdfguicontrol.py", line 530, in plot
from diffpy.pdfgui.control.plotter import Plotter
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/control/plotter.py", line 18, in <module>
from diffpy.pdfgui.gui.extendedplotframe import ExtendedPlotFrame
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/diffpy.pdfgui-1.0c1.dev_r2837_20090310-py2.5.egg/diffpy/pdfgui/gui/extendedplotframe.py", line 22, in <module>
matplotlib.use('WXAgg')
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/__init__.py", line 735, in use
raise RuntimeError(_use_error_msg)
RuntimeError: matplotlib.use() must be called *before* pylab
or matplotlib.backends is imported for the first time.

Pavol Juhas

unread,
Mar 17, 2009, 12:24:12 AM3/17/09
to diffp...@googlegroups.com, jessica.k...@gmail.com
On Mon, Mar 16, 2009 at 08:31:59PM -0400, dif...@diffpy.org wrote:
> reporter: jessica.k...@gmail.com
>
> summary: Still wants to call pylab before matplotlib.use
>
> description: I've just installed the prereleased version of pdfgui
> and this error is still coming up even though the code in
> extendedplotframe.py was already correct.

Hi Jessica,

Sorry about all the problems with getting pdfgui running. I checked
the code carefully and I am at loss why is this happening - pdfgui
does not even import pylab at all.

Please start pdfgui from a terminal using

python -v `which pdfgui` 2>pdfgui_import.log

and repeat the steps that caused the bug. This will write
a list of pdfgui imports to pdfgui_import.log - after you exit
the gui, send that file to my email address.

One more thing - if you are using C-style shell (csh or tcsh) the
command above would not work, you need to start it from either
sh, bash or zsh.

Good luck,

Pavol

--
Dr. Pavol Juhas
Applied Physics & Applied Mathematics
Columbia University
Room 200 Mudd Building, MC 4701
500 West 120th Street
New York, NY 10027

Pavol Juhas

unread,
Apr 1, 2009, 11:23:16 AM4/1/09
to diffp...@googlegroups.com
On Mon, Mar 16, 2009 at 08:31:59PM -0400, dif...@diffpy.org wrote:
> summary: Still wants to call pylab before matplotlib.use
...
> version: 1.0c1.dev-r2837-20090310
>
> traceback:
...

> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/__init__.py", line 735, in use
> raise RuntimeError(_use_error_msg)
> RuntimeError: matplotlib.use() must be called *before* pylab
> or matplotlib.backends is imported for the first time.

The error was due to incorrect installation of the matplotlib library
on a MAC computer. The issue was resolved after re-installing
numpy and matplotlib. I am not sure what caused the incorrect
installation, but I would recommend to install external dependencies
in the order of (1) numpy, (2) wxPython, (3) matplotlib.
Hope this helps,

Pavol

Reply all
Reply to author
Forward
0 new messages