python-matplotlib: Exception when drawing image on 64-bit system
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
matplotlib |
Unknown
|
Unknown
|
|||
matplotlib (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Binary package hint: python-matplotlib
This bug is also reported on the matplotlib sourceforge site, because I'm not sure if it's their
problem (i.e. code that is not 64-bit clean) or a packaging problem (i.e. some improper mix
of 32 and 64 bit code). Sorry for the duplication. Sourceforge bug ID: 2243945.
stars:~$ lsb_release -rd
Description: Ubuntu 8.10
Release: 8.10
stars:~$
stars:src$ apt-cache policy python-matplotlib
python-matplotlib:
Installed: 0.98.3-4ubuntu1
Candidate: 0.98.3-4ubuntu1
Version table:
*** 0.98.3-4ubuntu1 0
500 http://
100 /var/lib/
stars:src$
When I run on a Ubuntu 8.10 system on an AMD-64 processor, I get an
exception:
Traceback (most recent call last):
File
"/usr/lib/
333, in expose_event
self._render_
File
"/usr/lib/
321, in _render_figure
self.figure.draw (self._renderer)
File "/usr/lib/
in draw
for a in self.axes: a.draw(renderer)
File "/usr/lib/
draw
im.draw(renderer)
File "/usr/lib/
draw
*self.get_
File
"/usr/lib/
119, in draw_image
array[:,:,:] = image_array
ValueError: shape mismatch: objects cannot be broadcast to a single shape
If I go into the backend_gdk.py code and add a print statement on the
relevant sizes
array = pixbuf_
print 'arrayshape=', array.shape, 'image_
image_array.shape, rows, cols
array[:,:,:] = image_array
I find that
arrayshape= (372, 0, 497) image_array.shape= (372, 497, 4) 372 497
The zero in the middle is particularly odd. This array is generated by
_backend_gdk.c in the vicinity of line 46, and the code looks fine,
but I'll bet dollars to doughnuts that it's a 32bit/64-bit problem.
The "dims" array is presumably 64-bit integers, and
PyArray_
As a result, it'd treat the high 32-bits of the first dimension as a
dimension in its own right (giving the zero), and put the low 32 bits
of the second dimension in the third slot.
Is this a Ubuntu packaging problem (somehow mixing 32 and 64 bit libraries)
or
is it a matplotlib problem?
Changed in matplotlib: | |
assignee: | nobody → afflux |
status: | Confirmed → In Progress |
Changed in matplotlib: | |
importance: | Undecided → Medium |
status: | In Progress → Triaged |
assignee: | afflux → nobody |
Thank you for taking the time to report this bug and helping to make Ubuntu better. The package is build once for i386 and once for amd64. So there should be no 32 and 64 bit libraries mixed. Building matplotlib 0.98.3-6 on intrepid produces following warning. It looks like that the warning has something to do with this bug.
building 'matplotlib. backends. _backend_ gdk' extension aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fPIC -I/usr/ lib/python2. 4/site- packages/ numpy/core/ include -I/usr/include -I. -I/usr/include -I. -I/usr/ include/ pygtk-2. 0 -I/usr/ include/ glib-2. 0 -I/usr/ lib/glib- 2.0/include -I/usr/ include/ gtk-2.0 -I/usr/ lib/gtk- 2.0/include -I/usr/ include/ atk-1.0 -I/usr/ include/ cairo -I/usr/ include/ pango-1. 0 -I/usr/ include/ pixman- 1 -I/usr/ include/ freetype2 -I/usr/ include/ libpng12 -I/usr/ include/ python2. 4 -c src/backend_gdk.c -o build/temp. linux-x86_ 64-2.4/ src/backend_ gdk.o gtk-2.0/ gtk/gtk. h:224,
from /usr/include/ pygtk-2. 0/pygtk/ pygtk.h: 8,
from src/backend_ gdk.c:9: gtk-2.0/ gtk/gtkitemfact ory.h:47: warning: function declaration isn’t a prototype get_pixels_ array’: gdk.c:48: warning: passing argument 2 of ‘(struct PyObject * (*)(int, int *, struct PyArray_Descr *, char *))*(PyArray_API + 544u)’ from incompatible pointer type
gcc -pthread -fno-strict-
In file included from /usr/include/
/usr/include/
src/backend_gdk.c: In function ‘pixbuf_
src/backend_