Re: [Matplotlib-users] Any available backend for non-root users?

2012-08-17 Thread Moore, Eric (NIH/NIDDK) [F]


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 
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 
mailto:ben.r...@ou.edu>> wrote:

On Thu, Aug 16, 2012 at 4:26 PM, Liang Wang 
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 la

Re: [Matplotlib-users] Any available backend for non-root users?

2012-08-17 Thread Liang Wang
yes Eric, it was built without tk. But how do I specify the path to the tk
lib and headfile? I found them but have no idea how to pass them to the mpl
build.

Already thankful for your suggestions.
On Aug 17, 2012 11:14 AM, "Moore, Eric (NIH/NIDDK) [F]" 
wrote:

>  ** **
>
> ** **
>
> *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 
>
> 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  wrote:***
> *
>
> ** **
>
> On Thu, Aug 16, 2012 at 4:26 PM, Liang Wang  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. 

Re: [Matplotlib-users] Any available backend for non-root users?

2012-08-17 Thread Liang Wang
Appears that I have to build my own python  with tk/tcl instead of using
the default python, then rebuild mpl. What a pain.

Like this:
http://shanit.blogspot.com/2011/03/configuring-python-matplotlib-displays.html

On Fri, Aug 17, 2012 at 11:51 AM, Liang Wang  wrote:

> yes Eric, it was built without tk. But how do I specify the path to the tk
> lib and headfile? I found them but have no idea how to pass them to the mpl
> build.
>
> Already thankful for your suggestions.
> On Aug 17, 2012 11:14 AM, "Moore, Eric (NIH/NIDDK) [F]" <
> eric.moo...@nih.gov> wrote:
>
>>  ** **
>>
>> ** **
>>
>> *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 
>>
>> 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  wrote:**
>> **
>>
>> ** **
>>
>> On Thu, Aug 16, 2012 at 4:26 PM, Liang Wang  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 i

[Matplotlib-users] space between bar and y-axis: works with 2 bars not with 3

2012-08-17 Thread mgurling
I've attached 2.py and 3.py which differ only in how many bars are graphed.
The "nudge" variable was intended to move the left-most bar away from the
y-axis. This approach seems to work for graphs containing more than 2 bars,
but not those with only 2 bars. I'm curious about this behaviour and am
interested in a solution for 2-bar graphs.
http://matplotlib.1069221.n5.nabble.com/file/n38539/2.py 2.py 
http://matplotlib.1069221.n5.nabble.com/file/n38539/3.py 3.py 



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/space-between-bar-and-y-axis-works-with-2-bars-not-with-3-tp38539.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
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


[Matplotlib-users] installing matplotlib on mac os X with the *.dmg file

2012-08-17 Thread Timothy Duly
Hi,

I'm having trouble installing matplotlib on mac os x.  I downloaded the dmg
file 
(matplotlib-1.1.1-py2.7-python.org-macosx10.6.dmg
) from
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.1/.
I was able to install this package.  Beforehand, I installed python
from
python.org (I read about the need to do this rather than use the shipped
python for mac os x).  So, the original python is in /usr/bin/python and
the other, newer one, is in /usr/local/bin/python.

However, after running "ipython -pylab", I get an error message:

Python 2.7.1 (r271:86832, Aug  5 2011, 03:30:24)
Type "copyright", "credits" or "license" for more information.

IPython 0.13 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
[TerminalIPythonApp] GUI event loop or pylab initialization failed
---
ImportError   Traceback (most recent call last)
/Library/Python/2.7/site-packages/ipython-0.13-py2.7.egg/IPython/core/pylabtools.pyc
in find_gui_and_backend(gui)
194 """
195
--> 196 import matplotlib
197
198 if gui and gui != 'auto':

ImportError: No module named matplotlib

It seems that I don't have a module-- but I just installed it?

Side note:  I've read to the best of my ability this page here,
http://matplotlib.sourceforge.net/faq/installing_faq.html#os-x-notes , but
there seems to be a disconnect on this page between the actual installation
procedure.  For example, no where on this page does it mention about a
*.dmg file, yet the sourceforge site has the *.dmg file.  And this help
site mentions *.zip files, but this time the sourceforge download page does
not have any *.zip files!  What is going on here?

Thanks,
Tim
--
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


Re: [Matplotlib-users] installing matplotlib on mac os X with the *.dmg file

2012-08-17 Thread Paul Hobson
On Fri, Aug 17, 2012 at 2:30 PM, Timothy Duly  wrote:
> Hi,
>
> I'm having trouble installing matplotlib on mac os x.  I downloaded the dmg
> file (matplotlib-1.1.1-py2.7-python.org-macosx10.6.dmg) from
> http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.1/
> . I was able to install this package.  Beforehand, I installed python from
> python.org (I read about the need to do this rather than use the shipped
> python for mac os x).  So, the original python is in /usr/bin/python and the
> other, newer one, is in /usr/local/bin/python.
>
> However, after running "ipython -pylab", I get an error message:
>
> Python 2.7.1 (r271:86832, Aug  5 2011, 03:30:24)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.13 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> [TerminalIPythonApp] GUI event loop or pylab initialization failed
> ---
> ImportError   Traceback (most recent call last)
> /Library/Python/2.7/site-packages/ipython-0.13-py2.7.egg/IPython/core/pylabtools.pyc
> in find_gui_and_backend(gui)
> 194 """
> 195
> --> 196 import matplotlib
> 197
> 198 if gui and gui != 'auto':
>
> ImportError: No module named matplotlib
>
> It seems that I don't have a module-- but I just installed it?
>
> Side note:  I've read to the best of my ability this page here,
> http://matplotlib.sourceforge.net/faq/installing_faq.html#os-x-notes , but
> there seems to be a disconnect on this page between the actual installation
> procedure.  For example, no where on this page does it mention about a *.dmg
> file, yet the sourceforge site has the *.dmg file.  And this help site
> mentions *.zip files, but this time the sourceforge download page does not
> have any *.zip files!  What is going on here?
>
> Thanks,
> Tim

I can't comment on specifics, but things to watch out for:
1) Native Mac OS X's python vs python.org's python (the latter is preferred)
2) Numpy and other dependancies

Personally, I've had the best luck with the approach laid out here:
http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/

Best of luck,
-paul

--
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


Re: [Matplotlib-users] installing matplotlib on mac os X with the *.dmg file

2012-08-17 Thread Felix Patzelt
The dmg you are referring to appears to install to 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages 
(The main library, not the one for in our user directory). Most likely, this 
directory is not in pythons search path. Therefore, python can't find any 
modules installed there. To verify this, first check, whether this directory 
exists. Then start ipython and enter:

from sys import path
path

Path is a list of all paths which are searched for installed modules. If my 
suspicion is correct, the directory where you installed matplotlib is not in 
the list. You can just add it 

path.append('/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages')
 

and then import matplotlib. However, you have add it to your path again every 
time you start a new session. To add it permanently, put an otherwise empty 
text file which includes the path and place it in one of the directories that 
are already on the search path. You have add a .pth suffix to this text file 
when you save it.

Best,
Felix

ps: There are many ways to install python and packages and all are more 
complicated to what you are used to from the mac - welcome to the world of unix 
/ linux software... Still, I have been successful using either macports (slow, 
but reliable) as well as distribute and pip. I recommend macports which creates 
a new installation for everything you want / need in /opt. It can also install 
all of the ipython optional dependencies like the qtconsole and the notebook 
which cannot be done using pure python package managers.

Am 17.08.2012 um 23:30 schrieb Timothy Duly:

> Hi,
> 
> I'm having trouble installing matplotlib on mac os x.  I downloaded the dmg 
> file (matplotlib-1.1.1-py2.7-python.org-macosx10.6.dmg) from 
> http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.1/ 
> . I was able to install this package.  Beforehand, I installed python from 
> python.org (I read about the need to do this rather than use the shipped 
> python for mac os x).  So, the original python is in /usr/bin/python and the 
> other, newer one, is in /usr/local/bin/python.
> 
> However, after running "ipython -pylab", I get an error message:
> 
> Python 2.7.1 (r271:86832, Aug  5 2011, 03:30:24) 
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.13 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> [TerminalIPythonApp] GUI event loop or pylab initialization failed
> ---
> ImportError   Traceback (most recent call last)
> /Library/Python/2.7/site-packages/ipython-0.13-py2.7.egg/IPython/core/pylabtools.pyc
>  in find_gui_and_backend(gui)
> 194 """
> 195 
> --> 196 import matplotlib
> 197 
> 198 if gui and gui != 'auto':
> 
> ImportError: No module named matplotlib
> 
> It seems that I don't have a module-- but I just installed it?
> 
> Side note:  I've read to the best of my ability this page here, 
> http://matplotlib.sourceforge.net/faq/installing_faq.html#os-x-notes , but 
> there seems to be a disconnect on this page between the actual installation 
> procedure.  For example, no where on this page does it mention about a *.dmg 
> file, yet the sourceforge site has the *.dmg file.  And this help site 
> mentions *.zip files, but this time the sourceforge download page does not 
> have any *.zip files!  What is going on here?  
> 
> Thanks,
> Tim
> 
> 
> --
> 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

--
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


Re: [Matplotlib-users] Any available backend for non-root users?

2012-08-17 Thread Liang Wang
Finally I was able to compile mpl with tk following this link:
https://groups.google.com/forum/?fromgroups#!topic/sage-support/fV2VNL-5UuY%5B1-25%5D

basically you can hack setupext.py by manually change the paths for tcl.h
and tk.h

if tcl.h and tk.h are missing, then you have to install them in advance

On Fri, Aug 17, 2012 at 2:10 PM, Liang Wang  wrote:

> Appears that I have to build my own python  with tk/tcl instead of using
> the default python, then rebuild mpl. What a pain.
>
> Like this:
>
> http://shanit.blogspot.com/2011/03/configuring-python-matplotlib-displays.html
>
> On Fri, Aug 17, 2012 at 11:51 AM, Liang Wang  wrote:
>
>> yes Eric, it was built without tk. But how do I specify the path to the
>> tk lib and headfile? I found them but have no idea how to pass them to the
>> mpl build.
>>
>> Already thankful for your suggestions.
>> On Aug 17, 2012 11:14 AM, "Moore, Eric (NIH/NIDDK) [F]" <
>> eric.moo...@nih.gov> wrote:
>>
>>>  ** **
>>>
>>> ** **
>>>
>>> *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 
>>>
>>> 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  wrote:*
>>> ***
>>>
>>> ** **
>>>
>>> On Thu, Aug 16, 2012 at 4:26 PM, Liang Wang  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