eps files created by matplotlib stump evince

Bug #1179376 reported by Malek Ghantous
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
matplotlib
New
Undecided
Unassigned

Bug Description

In Ubuntu 13.04 I created an eps file in matplotlib and when trying to display the image with evince I get:

---
$ evince figure_2.eps
dictstackunderflow -4
dictstackunderflow -4

(evince:16040): EvinceDocument-CRITICAL **: ev_document_misc_pixbuf_from_surface: assertion `surface' failed

(evince:16040): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
dictstackunderflow -4

(evince:16040): EvinceDocument-CRITICAL **: ev_document_misc_pixbuf_from_surface: assertion `surface' failed

(evince:16040): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
dictstackunderflow -4
---

and so on, and the image is not displayed. gv displays the image but throws up an error diaglogue. This only happens with "usetex=True" set. It seems that for whatever reason an extra "end" is added to the eps file, since when I remove it everything seems to work fine. I'm not sure which package is actually responsible for the buggy behaviour - I've not seen this before and have been using the identical python code in the past with no issue.

Revision history for this message
Malek Ghantous (malektronic) wrote :

Oops, package name fail.

affects: bzr → matplotlib
Revision history for this message
WeatherGod (ben-v-root) wrote :

Bug report has been pushed upstream: https://github.com/matplotlib/matplotlib/issues/1997

Revision history for this message
Mike Droettboom (mdboom) wrote :

I am unable to reproduce this using matplotlib 1.2.1, 1.2.x (maintenance branch) or master. Can you provide a short example that reproduces the bug, or an example eps file that doesn't display in evince?

Revision history for this message
Malek Ghantous (malektronic) wrote : Re: [Bug 1179376] Re: eps files created by matplotlib stump evince
  • epstest.py Edit (129 bytes, application/octet-stream; name="epstest.py")
  • sine.eps Edit (101.8 KiB, application/postscript; name="sine.eps")

I've attached a short python file that's supposed to generate a sine
curve, and the output file I get is attached. By removing the "end"
command on line 1497 of the eps file everything works, otherwise it
throws up the errors and doesn't display. gv shows up a different
bunch of errors, though it does display the image:

----
Error: /dictstackunderflow in --end--GPL Ghostscript 9.07:
Unrecoverable error, exit code 1

Operand stack:

Execution stack:
   %interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval--
--nostringval-- --nostringval-- false 1 %stopped_push 1916
1 3 %oparray_pop 1915 1 3 %oparray_pop --nostringval--
1899 1 3 %oparray_pop 1787 1 3 %oparray_pop
--nostringval-- %errorexec_pop .runexec2 --nostringval--
--nostringval-- --nostringval-- 2 %stopped_push
--nostringval--
Dictionary stack:
   --dict:1170/1684(ro)(G)-- --dict:0/20(G)-- --dict:81/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 104278
----

Revision history for this message
Mike Droettboom (mdboom) wrote :

Thanks for the additional info. I am still unable to reproduce this. Do you have any non-standard rcParam settings?

Revision history for this message
Malek Ghantous (malektronic) wrote :

I removed everything from the .matplotlib directory and still have the
same issue. As far as I can tell I'm running a pretty stock ubuntu
13.04 install (I still haven't carried over my .profile and other
files from a previous installation), though it might have something to
do with the specific python libraries and latex packages I have
installed. I'm happy to send the output of apt-cache --install or
such if you think it will help. Or is it a ghostscript problem? I
can, on the other hand, produce ps and pdf files with otherwise the
same code with no issue.

2013/5/16 Mike Droettboom <email address hidden>:
> Thanks for the additional info. I am still unable to reproduce this.
> Do you have any non-standard rcParam settings?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1179376
>
> Title:
> eps files created by matplotlib stump evince
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/matplotlib/+bug/1179376/+subscriptions

Revision history for this message
Malek Ghantous (malektronic) wrote :

Also, just to clarify regarding the comments on github, there is only
one "end" statement, but apparently no corresponding "begin" (so it's
not that they are doubled as such).

2013/5/16 Malek <email address hidden>:
> I removed everything from the .matplotlib directory and still have the
> same issue. As far as I can tell I'm running a pretty stock ubuntu
> 13.04 install (I still haven't carried over my .profile and other
> files from a previous installation), though it might have something to
> do with the specific python libraries and latex packages I have
> installed. I'm happy to send the output of apt-cache --install or
> such if you think it will help. Or is it a ghostscript problem? I
> can, on the other hand, produce ps and pdf files with otherwise the
> same code with no issue.
>
> 2013/5/16 Mike Droettboom <email address hidden>:
>> Thanks for the additional info. I am still unable to reproduce this.
>> Do you have any non-standard rcParam settings?
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1179376
>>
>> Title:
>> eps files created by matplotlib stump evince
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/matplotlib/+bug/1179376/+subscriptions

Revision history for this message
Mike Droettboom (mdboom) wrote :

Can you try setting `rc('ps', distiller='xpdf')` and then `rc('ps', distiller='ghostscript')` and see if that makes any difference?

Revision history for this message
Malek Ghantous (malektronic) wrote :
  • sine.eps Edit (31.0 KiB, application/postscript; name="sine.eps")

rc('ps',usedistiller='xpdf') works, usedistiller='ghostscript' throws
up the same error (presumably that's the default? I don't have a
.matplotlibrc file).

I've attached the xpdf-distilled file. That workaround solves my
problem (and generates smaller and nicer eps files), but it's still
curious that ghostscript generates a faulty file. Perhaps matplotlib
should just use xpdf by default?

2013/5/17 Mike Droettboom <email address hidden>:
> Can you try setting `rc('ps', distiller='xpdf')` and then `rc('ps',
> distiller='ghostscript')` and see if that makes any difference?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1179376
>
> Title:
> eps files created by matplotlib stump evince
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/matplotlib/+bug/1179376/+subscriptions

Revision history for this message
Thomas Caswell (tcaswell-gmail) wrote :

I can confirm this bug (and the work around) on 13.04, python 2.7, and current master branch of mpl.

Revision history for this message
Mike Droettboom (mdboom) wrote :

Yes, it is curious that ghostscript is generating a faulty file. I'm going to summarize these results back over on the matplotlib issue and see if anyone else has any ideas.

Revision history for this message
Mike Droettboom (mdboom) wrote :

See

https://github.com/matplotlib/matplotlib/issues/1997

for @leejjoon's resolution of this issue and

https://github.com/matplotlib/matplotlib/pull/2033

for a fix.

The patch in issue #2033 applies cleanly to 1.2.1 so Ubuntu could include the patch in its .deb (theoretically), and will make it into the next maintenance release (1.2.2) and major release (1.3.0).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.