You can use the "Agg" or "PDF" backends to run matplotlib without 
display support:

import matplotlib
matplotlib.use("PDF")

Cheers,
Mike

John Kerenyi wrote:
> Thank you for your response. Your response made me wonder how the script 
> would operate in a non-graphic environment--I had tested it on a login node 
> but not on a computing node. It appears that even though I have no need for 
> any graphic display, the modules I am loading expect to have it nonetheless. 
> I invoke matplotlib using the standard "import matplotlib.pyplot as plt" 
> line. Here is the output when run on a compute node:
>
> -------------------------
>
> [ac.jkere...@n123 pygraph]$ ./run_pygraph.py png
> Creating Top 100 V/C ratios graph...
> Traceback (most recent call last):
>   File "./run_pygraph.py", line 566, in <module>
>     GraphTop100VC (Top100VCFilename)
>   File "./run_pygraph.py", line 326, in GraphTop100VC
>     fig=plt.figure()
>   File "/soft/python/lib/python2.6/site-packages/matplotlib/pyplot.py", line 
> 251, in figure
>     **kwargs)
>   File 
> "/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py",
>  line 90, in new_figure_manager
>     window = Tk.Tk()
>   File "/soft/python/lib/python2.6/lib-tk/Tkinter.py", line 1643, in __init__
>     self.tk = _tkinter.create(screenName, baseName, className, interactive, 
> wantobjects, useTk, sync, use)
> _tkinter.TclError: no display name and no $DISPLAY environment variable
>
> ---------------------
>
> Can anyone advise if there another way to invoke matplotlib that does not 
> require graphic support?
>
> With respect to your suggestion that I run python setup.py build, I don't 
> seem to have the necessary permissions but the sysadmin is very helpful and 
> once I have a little more information on the new problem I'll get his help 
> again.
>
> Thanks again,
>
> John Kerenyi
>
> -----Original Message-----
> From: Jouni K. Seppänen [mailto:j...@iki.fi] 
> Sent: Wednesday, July 22, 2009 9:38 AM
> To: matplotlib-users@lists.sourceforge.net
> Subject: Re: [Matplotlib-users] PDF backend errors out; PNG works fine
>
> "John Kerenyi" <jo...@moval.org> writes:
>
>   
>>   File
>> "/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_
>> pd
>> f.py", line 44, in <module>
>>     from matplotlib import ttconv
>> ImportError:
>> /soft/python/lib/python2.6/site-packages/matplotlib/ttconv.so: 
>> undefined
>> symbol: _ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE
>>     
>
> Sounds like a mismatch between C++ libraries on the system where matplotlib 
> was built and where it is being used. You mentioned a cluster; perhaps your 
> sysadmin compiled matplotlib on a special node that has more libraries 
> installed than the computation nodes. I don't know how to fix this, but as a 
> first step you could try compiling matplotlib on a computation node (submit 
> something like "python setup.py build" as a job the same way you would submit 
> another task on the
> cluster) and seeing if that gives more clues about what is missing.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to