Upgraded to 1.1.0, now only line graphs work!

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:

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-git

The three-line simple_plot.py script suggested here...

http://matplotlib.sourceforge.net/faq/installing_faq.html

...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
$HOME=/home/john
CONFIGDIR=/home/john/.matplotlib
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
findfont:
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)
plt.show()

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):
  File
"/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtk.py", line 418, in expose_event
    self._render_figure(self._pixmap, w, h)
  File
"/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure
    FigureCanvasAgg.draw(self)
  File
"/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_agg.py", line 400, in draw
    self.figure.draw(self.renderer)
  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
    func(*args)
  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
    a.draw(renderer)
  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
    transformed_viewLim)
  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
work.

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?

Ben Root

···

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:

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-git

The three-line simple_plot.py script suggested here…

http://matplotlib.sourceforge.net/faq/installing_faq.html

…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
$HOME=/home/john
CONFIGDIR=/home/john/.matplotlib

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
findfont:
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)
plt.show()

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):
File
“/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtk.py”, line 418, in expose_event
self._render_figure(self._pixmap, w, h)

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

self.figure.draw(self.renderer)
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
func(*args)
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
a.draw(renderer)
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
transformed_viewLim)
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
work.

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!