Upgraded to 1.1.0, now only line graphs work!

I meant to send this to the list yesterday, but I just noticed I sent it only to Ben. For completeness, here it is…


---------- Forwarded message ----------
From: Warren Weckesser <warren.weckesser@…1036…>

Date: Sat, Nov 12, 2011 at 8:45 PM
Subject: Re: [Matplotlib-users] Upgraded to 1.1.0, now only line graphs work!
To: Benjamin Root <ben.root@…1304…>

On Sat, Nov 12, 2011 at 8:03 PM, Benjamin Root <ben.root@…1304…> wrote:

On Saturday, November 12, 2011, John Ladasky <john_ladasky@…209…> wrote:

Two days ago I posted some questions about upgrading, and was pointed to

the right resources by some readers who replied to me privately
(thanks!). I am running Python 2.6 on an Ubuntu Linux 10.10 platform.
The upgrade appeared to build successfully, but I still have problems.

Line graphs appear to be working all right, but images and contour
graphs generate errors, and fail to draw.

My procedure:

I deleted every last old matplotlib-related file from my hard disk,from

both my Python dist-packages directory and from my home directory. I
got my build dependencies up to date, and installed using git as
described here:


The three-line simple_plot.py script suggested here…


…runs, displays a line graph, and outputs the following when run with
the flag --verbose-helpful:

17:26:42 -> python simple_plot.py --verbose-helpful


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.2.x

verbose.level helpful
interactive is False
platform is linux2
Using fontManager instance from /home/john/.matplotlib/fontList.cache
backend GTKAgg version 2.21.0

Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (/usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf) with score of 0.000000

Now, here’s a very simple script of mine, which should draw a figure
with a colored bulls-eye:

from numpy import exp, fromfunction, hypot
import matplotlib.pyplot as plt

def func(x, y):
return exp(-hypot(x-50,y-50) / 20)

fig = plt.figure()
ax = plt.subplot(111)
arr = fromfunction(func, (101,101))
img = plt.imshow(arr)

Instead, it draws an empty figure, and returns a long and
apparently-repeated traceback, which I hesitate to post in its entirety.
Here’s the last repeat. I believe that I got this eight times in a row:

Traceback (most recent call last):
“/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtk.py”, line 418, in expose_event
self._render_figure(self._pixmap, w, h)

“/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtkagg.py”, line 75, in _render_figure
“/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_agg.py”, line 400, in draw

File “/usr/local/lib/python2.6/dist-packages/matplotlib/artist.py”,
line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File “/usr/local/lib/python2.6/dist-packages/matplotlib/figure.py”,

line 886, in draw
File “/usr/local/lib/python2.6/dist-packages/matplotlib/artist.py”,
line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)

File “/usr/local/lib/python2.6/dist-packages/matplotlib/axes.py”, line

1983, in draw
File “/usr/local/lib/python2.6/dist-packages/matplotlib/artist.py”,
line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)

File “/usr/local/lib/python2.6/dist-packages/matplotlib/image.py”,
line 356, in draw
im = self.make_image(renderer.get_image_magnification())
File “/usr/local/lib/python2.6/dist-packages/matplotlib/image.py”,

line 576, in make_image
File “/usr/local/lib/python2.6/dist-packages/matplotlib/image.py”,
line 202, in _get_unsampled_image
x = self.to_rgba(self._A, bytes=True)

File “/usr/local/lib/python2.6/dist-packages/matplotlib/cm.py”, line
215, in to_rgba
x = self.cmap(x, alpha=alpha, bytes=bytes)
File “/usr/local/lib/python2.6/dist-packages/matplotlib/colors.py”,

line 521, in call
cbook._putmask(xa, xa==1.0, np.nextafter(xa.dtype.type(1),
AttributeError: ‘module’ object has no attribute ‘nextafter’

Programs which invoke contour() instead of imshow() fail similarly. I

downloaded the 1.1.0 animation examples (my whole reason for upgrading
was to use the new animation methods), and only the line-graph examples

As suggested (on a page I can’t quite track down now), I captured a log

of the build and install commands. The words “error” or “warning” do
not show up in either of those logs – and I did get several warnings
when building 0.99 and 1.0.1, so I feel like things ought to be working

better this time, not worse…

Thanks for any hints!

Looks like mpl truly can’t be used with older version of numpy. Which version are you using?

The version of numpy in Ubuntu 10.10 is 1.3, but the ‘nextafter’ function was added to numpy in version 1.4.

This page:

says “matplotlib requires numpy version 1.1 or later”, so either that page is incorrect, or a newer feature of numpy has been used in the matplotlib code unintentionally.


Ben Root

RSA® Conference 2012

Save $700 by Nov 18

Register now


Matplotlib-users mailing list