show() command does not create plot with agg, only with wx

Hello,

The only backend which works on my machine is wx.
The problem I was having was that matplotlib installed fine, but didn’t show plots. I tried removing matplotlib and re-installing,
that didn’t help. I was using the Agg backend and figure windows did not get created. Cairo doesn’t work either.

I can live with only using wx, but

On my machine, I test with the following script:
from pylab import *
ion()
fig = figure()
plot([1,2,3])
show()
fig.savefig(‘test.png’)

With agg, the figure saves correctly, but no window appears. With wx, a window with the plot appears. I’m running numpy 1.5.0 (also built from source).

OS: Ubuntu 10.04
uname output: Linux 2.6.32-25-generic-pae #44-Ubuntu SMP
matplotlib version: 1.0.0
verbose output of script above:
matplotlib data path /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data

loaded rc file /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.0.0
verbose.level helpful
interactive is False
units is False
platform is linux2
Using fontManager instance from .matplotlib/fontList.cache

backend agg version v2.2

basedirlist is: [’/usr/local’, ‘/usr’]

···

============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.0.0

            python: 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)  [GCC
                    4.4.3]
          platform: linux2

REQUIRED DEPENDENCIES
numpy: 1.5.0
freetype2: 9.22.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.42
Tkinter: no
* Using default library and include directories for
* Tcl and Tk because a Tk window failed to open.

                    * You may need to define DISPLAY for Tk to work so
                    * that setup can determine where your libraries are
                    * located. Tkinter present, but header files are not

                    * found. You may need to install development
                    * packages.
          wxPython: 2.8.10.1
                    * WxAgg extension not required for wxPython >= 2.8

        pkg-config: looking for pygtk-2.0 gtk+-2.0
                    * Package pygtk-2.0 was not found in the pkg-config
                    * search path. Perhaps you should add the directory
                    * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH

                    * environment variable No package 'pygtk-2.0' found
                    * You may need to install 'dev' package(s) to
                    * provide header files.
              Gtk+: no

                    * Could not find Gtk+ headers in any of
                    * '/usr/local/include', '/usr/include', '.'
   Mac OS X native: no
                Qt: no

               Qt4: Qt: 4.6.2, PyQt4: 4.7.2
             Cairo: 1.8.8

OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: 1.4.1
pytz: 2010b

OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 8.71
latex: no
pdftops: 0.12.4

[Edit setup.cfg to suppress the above messages]

pymods [‘pylab’]
packages [‘matplotlib’, ‘matplotlib.backends’, ‘matplotlib.backends.qt4_editor’, ‘matplotlib.projections’, ‘matplotlib.testing’, ‘matplotlib.testing.jpl_units’, ‘matplotlib.tests’, ‘mpl_toolkits’, ‘mpl_toolkits.mplot3d’, ‘mpl_toolkits.axes_grid’, ‘mpl_toolkits.axes_grid1’, ‘mpl_toolkits.axisartist’, ‘matplotlib.sphinxext’, ‘matplotlib.numerix’, ‘matplotlib.numerix.mlab’, ‘matplotlib.numerix.ma’, ‘matplotlib.numerix.linear_algebra’, ‘matplotlib.numerix.random_array’, ‘matplotlib.numerix.fft’, ‘matplotlib.tri’, ‘matplotlib.delaunay’]

running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-i686-2.6/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.linux-i686-2.6/matplotlib/mpl-data

running build_ext

-Jacob

Jacob,

It should be expected that using the Agg backend causes no figure window to appear because Agg is meant for head-less environments like servers and such. The reason no other backend seem available to you is that you do not appear to have the appropriate development libraries available (except, apparently the wx libraries… go figure).

Which Linux are you using? In Debian based systems, you can grab the build dependencies for a package with a command like:

apt-get build-dep matplotlib

(or whatever the package name is on Ubuntu). The nice thing about this is that it will download and install everything you need to build matplotlib, but without downloading and installing matplotlib itself. Note that it will install numpy, so if you have that manually installed, you will need to work around that.

Ben Root

···

On Thu, Oct 7, 2010 at 7:55 PM, Jacob Silterra <jsilter@…287…> wrote:

Hello,

The only backend which works on my machine is wx.
The problem I was having was that matplotlib installed fine, but didn’t show plots. I tried removing matplotlib and re-installing,
that didn’t help. I was using the Agg backend and figure windows did not get created. Cairo doesn’t work either.

I can live with only using wx, but

On my machine, I test with the following script:
from pylab import *
ion()
fig = figure()
plot([1,2,3])
show()
fig.savefig(‘test.png’)

With agg, the figure saves correctly, but no window appears. With wx, a window with the plot appears. I’m running numpy 1.5.0 (also built from source).

OS: Ubuntu 10.04
uname output: Linux 2.6.32-25-generic-pae #44-Ubuntu SMP
matplotlib version: 1.0.0
verbose output of script above:
matplotlib data path /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data

loaded rc file /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.0.0
verbose.level helpful
interactive is False
units is False
platform is linux2
Using fontManager instance from .matplotlib/fontList.cache

backend agg version v2.2

basedirlist is: [‘/usr/local’, ‘/usr’]

BUILDING MATPLOTLIB
matplotlib: 1.0.0

            python: 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)  [GCC
                    4.4.3]
          platform: linux2

REQUIRED DEPENDENCIES
numpy: 1.5.0
freetype2: 9.22.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.42
Tkinter: no
* Using default library and include directories for
* Tcl and Tk because a Tk window failed to open.

                    * You may need to define DISPLAY for Tk to work so
                    * that setup can determine where your libraries are
                    * located. Tkinter present, but header files are not




                    * found. You may need to install development
                    * packages.
          wxPython: 2.8.10.1
                    * WxAgg extension not required for wxPython >= 2.8




        pkg-config: looking for pygtk-2.0 gtk+-2.0
                    * Package pygtk-2.0 was not found in the pkg-config
                    * search path. Perhaps you should add the directory
                    * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH




                    * environment variable No package 'pygtk-2.0' found
                    * You may need to install 'dev' package(s) to
                    * provide header files.
              Gtk+: no




                    * Could not find Gtk+ headers in any of
                    * '/usr/local/include', '/usr/include', '.'
   Mac OS X native: no
                Qt: no




               Qt4: Qt: 4.6.2, PyQt4: 4.7.2
             Cairo: 1.8.8

OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: 1.4.1
pytz: 2010b

OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 8.71
latex: no
pdftops: 0.12.4

[Edit setup.cfg to suppress the above messages]

pymods [‘pylab’]
packages [‘matplotlib’, ‘matplotlib.backends’, ‘matplotlib.backends.qt4_editor’, ‘matplotlib.projections’, ‘matplotlib.testing’, ‘matplotlib.testing.jpl_units’, ‘matplotlib.tests’, ‘mpl_toolkits’, ‘mpl_toolkits.mplot3d’, ‘mpl_toolkits.axes_grid’, ‘mpl_toolkits.axes_grid1’, ‘mpl_toolkits.axisartist’, ‘matplotlib.sphinxext’, ‘matplotlib.numerix’, ‘matplotlib.numerix.mlab’, ‘matplotlib.numerix.ma’, ‘matplotlib.numerix.linear_algebra’, ‘matplotlib.numerix.random_array’, ‘matplotlib.numerix.fft’, ‘matplotlib.tri’, ‘matplotlib.delaunay’]

running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc → build/lib.linux-i686-2.6/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf → build/lib.linux-i686-2.6/matplotlib/mpl-data

running build_ext

-Jacob