From: James L. <jwl...@gm...> - 2005-11-25 22:47:10
|
I have intermittent problems with the savefig('foo.eps') command when I am using my native LaTeX interpreter to produce eps files. The really frustrating thing is that it is intermittent. Sometimes I can save a file that looks fine and sometimes I can't. My box is running Fedora Core 4 and kernel 2.6.14. I have the following rpms: python-2.4.1-2 ipython-0.6.15-1.fc4 python-tools-2.4.1-2 python-matplotlib-0.84-1.fc4 python-numeric-23.7-2 Fedora has an out of date ghostscript 7.07, so I installed ghostscript-8.51from source into /usr/local, but not the fonts, since they seemed unnecessary. As long as I don't use rc('text', usetex=3DTrue) I'm ok, but whenever I turn it on, it doesn't work consistently. Here's some sample code to demonstrate the problem. If I comment out the r= c line, it works fine. #!/usr/bin/env python from matplotlib import rc from matplotlib.numerix import arange, cos, pi from pylab import * forces =3D [1, 2, 3, 4] pofn =3D [.2, .09, .01, .005] rc('text', usetex=3DTrue) figure(1) semilogy(forces,pofn,'k') xlabel(r'$f_n =3D F_n/\langle F_n \rangle$') ylabel(r'$P(f_n)$') axis([0,5,.001,1]) savefig('mtest1.eps') However, if I run it as is, then I get the following: [jwlandry@merrimac hopper]$ ./mat-test.py --verbose-helpful matplotlib data path /usr/share/matplotlib $HOME=3D/home/jwlandry CONFIGDIR=3D/home/jwlandry/.matplotlib loaded rc file /home/jwlandry/.matplotlib/matplotlibrc matplotlib version 0.84 verbose.level helpful interactive is False platform is linux2 numerix Numeric 23.7 font search path ['/usr/share/matplotlib'] loaded ttfcache file /home/jwlandry/.matplotlib/ttffont.cache backend GTK version 2.6.2 This is dvips(k) 5.95a Copyright 2005 Radical Eye Software ( www.radicaleye.com) ' TeX output 2005.11.25:1645' -> e0dab64d0b15f2821ec713a6e7903ff4.ps <tex.pro><psfrag.pro><texps.pro><special.pro><color.pro>. <cmr8.pfb> <cmsy8.pfb><cmsy10.pfb><cmmi8.pfb><cmmi10.pfb><cmr10.pfb>[1 <e0dab64d0b15f2821ec713a6e7903ff4.eps>] When it doesn't work, a dialog box opens with this message Save figure failure: None: Interrupted system call Help! James Landry -- James W. Landry jwl...@gm... |
From: James L. <jwl...@gm...> - 2005-11-26 01:30:08
|
Thanks for the suggestion Jose. I installed the new version and the same problem appeared again. I'm getting some ideas though. When I tried it again by uncommenting the rc line, it worked the first time but not the second. Doesn't it cache some of the information? Could that be the problem? James Landry On 11/25/05, Jos=E9 Matos <jao...@gm...> wrote: > > On 25/11/05, James Landry <jwl...@gm...> wrote: > > I have intermittent problems with the savefig('foo.eps') command when I > am > > using my native LaTeX interpreter to produce eps files. The really > > frustrating thing is that it is intermittent. Sometimes I can save a > file > > that looks fine and sometimes I can't. > > > > My box is running Fedora Core 4 and kernel 2.6.14. > > > > I have the following rpms: > > python-2.4.1-2 > > ipython-0.6.15-1.fc4 > > python-tools-2.4.1-2 > > python-matplotlib-0.84-1.fc4 > > python-numeric-23.7-2 > > Probably it is irrelevant to this problem and it does not help here > but notice that 0.85 is available from extras. > -- James W. Landry jwl...@gm... |
From: John H. <jdh...@ac...> - 2005-11-26 03:20:05
|
>>>>> "James" == James Landry <jwl...@gm...> writes: James> When it doesn't work, a dialog box opens with this message James> Save figure failure: None: Interrupted system call What backend are you using? I have seen something like this on GTK*. I'm pretty sure it is a threading problem. Basically, we need a backend dependent thread-safe way to make system calls. Not a trivial task. I've posted a thread about this to the pygtk mailing list a few months ago, but have yet to find a reliable recipe. gtk gurus, please advise. In the meantime, you may want to try a different GUI backend, eg, tkagg. If this helps, let us know, because it will help determine that this is indeed your problem. JDH |
From: James L. <jwl...@gm...> - 2005-11-26 04:16:16
|
I tried using tkagg by setting backend : TkAgg in my matplotlibrc, which includes only the following lines: backend : TkAgg # latex options for matplotlib font.latex.package : type1cm text.usetex : False text.tex.engine : latex I get the following message, when I try to use it, which I don't understand= , because I have tkinter installed: [jwlandry@merrimac flow]$ ~/grain/plots/hopper/pof-w-insert.py data_hopper- 40k-r1.5.funnel-pof.combo data_hopper-40k-r2.funnel-pof.combo data_hopper- 40k-r4.funnel-pof.combo data_hopper-40k-r6.funnel-pof.combo Traceback (most recent call last): File "/home/jwlandry/grain/plots/hopper/pof-w-insert.py", line 12, in ? from pylab import * File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ? from matplotlib.pylab import * File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 217, in ? new_figure_manager, draw_if_interactive, show =3D pylab_setup() File "/usr/lib/python2.4/site-packages/matplotlib/backends/__init__.py", line 24, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py", line 8, in ? import tkagg # Paint image to Tk photo blitter extensio= n File "/usr/lib/python2.4/site-packages/matplotlib/backends/tkagg.py", lin= e 1, in ? import _tkagg ImportError: No module named _tkagg James On 11/25/05, John Hunter <jdh...@ac...> wrote: > > >>>>> "James" =3D=3D James Landry <jwl...@gm...> writes: > > James> When it doesn't work, a dialog box opens with this message > > James> Save figure failure: None: Interrupted system call > > What backend are you using? I have seen something like this on GTK*. > I'm pretty sure it is a threading problem. Basically, we need a > backend dependent thread-safe way to make system calls. Not a trivial > task. I've posted a thread about this to the pygtk mailing list a few > months ago, but have yet to find a reliable recipe. gtk gurus, please > advise. > > In the meantime, you may want to try a different GUI backend, eg, > tkagg. If this helps, let us know, because it will help determine > that this is indeed your problem. > > > JDH > -- James W. Landry jwl...@gm... |
From: John H. <jdh...@ac...> - 2005-11-26 04:27:21
|
>>>>> "James" == James Landry <jwl...@gm...> writes: James> I get the following message, when I try to use it, which I James> don't understand, because I have tkinter installed: It means that matpltolib was not able to find the tk src code needed to compile the tkagg extension. Usually this is because you haven't installed the tk-dev and tcl-dev packages. JDH |
From: James L. <jwl...@gm...> - 2005-11-26 04:40:30
|
Maybe this is a dumb question, but I've installed tk-devel and tcl-devel. Still doesn't work. Do I need to reinstall matplotlib or do it from source= ? James On 11/25/05, John Hunter <jdh...@ac...> wrote: > > >>>>> "James" =3D=3D James Landry <jwl...@gm...> writes: > > James> I get the following message, when I try to use it, which I > James> don't understand, because I have tkinter installed: > > It means that matpltolib was not able to find the tk src code needed > to compile the tkagg extension. Usually this is because you haven't > installed the tk-dev and tcl-dev packages. > > JDH > -- James W. Landry jwl...@gm... |
From: John H. <jdh...@ac...> - 2005-11-26 05:00:58
|
>>>>> "James" == James Landry <jwl...@gm...> writes: James> Maybe this is a dumb question, but I've installed tk-devel James> and tcl-devel. Still doesn't work. Do I need to reinstall James> matplotlib or do it from source? Yes, after installing the dev headers you will need to rebuild matplotlib from src. I suggest you capture the output of the build process is case you need to post it > sudo rm -rf build > sudo python setup.py install >& build.out JDH James> James James> On 11/25/05, John Hunter <jdh...@ac...> James> wrote: >> >>>>> "James" == James Landry <jwl...@gm...> writes: >> James> I get the following message, when I try to use it, which I James> don't understand, because I have tkinter installed: >> It means that matpltolib was not able to find the tk src code >> needed to compile the tkagg extension. Usually this is because >> you haven't installed the tk-dev and tcl-dev packages. >> >> JDH >> James> -- James W. Landry jwl...@gm... |
From: James L. <jwl...@gm...> - 2005-11-27 02:55:50
|
It works fine in TkAgg. That implies that you are right and it is a threading problem in pygtk. Thanks a lot for tracking this down. James Landry On 11/25/05, John Hunter <jdh...@ac...> wrote: > > >>>>> "James" =3D=3D James Landry <jwl...@gm...> writes: > > James> Maybe this is a dumb question, but I've installed tk-devel > James> and tcl-devel. Still doesn't work. Do I need to reinstall > James> matplotlib or do it from source? > > Yes, after installing the dev headers you will need to rebuild > matplotlib from src. I suggest you capture the output of the build > process is case you need to post it > > > sudo rm -rf build > > sudo python setup.py install >& build.out > > JDH > > James> James > > James> On 11/25/05, John Hunter <jdh...@ac...> > James> wrote: > >> >>>>> "James" =3D=3D James Landry <jwl...@gm...> writes: > >> > James> I get the following message, when I try to use it, which I > James> don't understand, because I have tkinter installed: > >> It means that matpltolib was not able to find the tk src code > >> needed to compile the tkagg extension. Usually this is because > >> you haven't installed the tk-dev and tcl-dev packages. > >> > >> JDH > >> > > > > James> -- James W. Landry jwl...@gm... > -- James W. Landry jwl...@gm... |