From: Liang Wang [mailto:frank0...@gmail.com]
Sent: Thursday, August 16, 2012 6:50 PM
To: Benjamin Root
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Any available backend for non-root users?

Thank you Ben,
I did use -X option upon ssh and I am running linux locally. The DISPLAY 
variable is automatically "localhost:17.0", where the number 17 changes for 
each login. But Tk would not work even after I export a new value to DISPLAY 
like ":0.0". I even tried reinstalling matplotlib (from source or through 
easy_install) with both values of DISPLAY but it always warns that Tk window 
failed to open. When I try to use TkAgg, it says

...
    import matplotlib.backends.tkagg as tkagg
  File 
"/ccs/home/lag69/.local/lib/python2.7/site-packages/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/backends/tkagg.py",
 line 1, in <module>
    import _tkagg
ImportError: No module named _tkagg

So far I haven't solved this problem and I have to generate png files to view 
them (I can view them by xview or display of ImageMagick so the x11 forwarding 
does work)

This is odd, and I almost lost my patient to try. But I still want to 
appreciate your generous help, Ben.

regards,
Liang
On Thu, Aug 16, 2012 at 4:54 PM, Benjamin Root 
<ben.r...@ou.edu<mailto:ben.r...@ou.edu>> wrote:

On Thu, Aug 16, 2012 at 4:26 PM, Liang Wang 
<frank0...@gmail.com<mailto:frank0...@gmail.com>> wrote:
Hi everyone. I have trouble to find a usable background on a remote server 
where I do not have root privilege. Unfortunately, there is no backend 
available:

               Tkinter: no
                        * Using default library and include directories for
                        * Tcl and Tk because a Tk window failed to open.
                        * You may need to define DISPLAY for Tk to work so
                        * that setup can determine where your libraries are
                        * located. Tkinter present, but header files are not
                        * found. You may need to install development
                        * packages.
                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must be able
                        * to "import gtk" in your build/install environment
       Mac OS X native: no
                    Qt: no
                   Qt4: no
                PySide: no
                 Cairo: no

The output of a simple script is
==================
simple_plot.py:
#
from pylab import *
plot([1,2,3])
show()
#
python simple_plot.py --verbose-helpful > output.txt
==================
$HOME=/ccs/home/user1
CONFIGDIR=/ccs/home/user1/.matplotlib
matplotlib data path 
/ccs/home/user1/.local/lib/python2.7/site-packages/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl-data
loaded rc file 
/ccs/home/user1/.local/lib/python2.7/site-packages/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.1.0
verbose.level helpful
interactive is False
platform is linux2
Using fontManager instance from /ccs/home/user1/.matplotlib/fontList.cache
backend agg version v2.2

When I tried to install pygtk, it requires glib, which is missing, and I just 
did not digg further. So, is there any workaround that I can get ANY backend to 
work (to show images on screen).


Any suggestions will be greatly appreciated (I really want to get things to 
work).

Regards,
Liang


The Agg backend is always available for non-interactive plotting.  In other 
words, you won't be able to do a show() call, but you can save to any of the 
image formats.  The TkAgg backend should also be an option (unless that python 
was built without Tk, which is rare).  Often, if Tk isn't working, it is a 
simple matter of setting your display environment correctly.  Most of the time, 
simply passing the "-X" option to ssh is sufficient (assuming you are sshing 
from a linux box).  Otherwise, I think you have to mess around with your 
DISPLAY environment variable on the remote server (I think it is usually 
":0.0", but I am no expert on this.

I hope that helps!
Ben Root


You need to install one of the optional backends.  In your original email  the 
output you included is showing "no" for all of the interactive backends.  So 
somewhere when you're building mpl, either you don't have the right things 
installed or the build is unable to locate them.  Tk wasn't found during the 
build, so no module called _tkagg was built, hence the import fails as you 
report in your second email. Your current problem isn't with DISPLAY, but with 
the build.  Hopefully someone else can suggest some appropriate steps to take 
to solve you build problems, but I'd first check if your python was built with 
Tk.

Eric

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to