Any available backend for non-root users?

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

Relevant info is:

output of build:

================

basedirlist is: [‘/usr/local’, ‘/usr’]

============================================================================

BUILDING MATPLOTLIB

matplotlib: 1.1.1

python: 2.7.2 (default, Sep 27 2011, 21:40:17) [GCC 4.3.4

[gcc-4_3-branch revision 152973]]

platform: linux2

REQUIRED DEPENDENCIES

numpy: 1.6.1

freetype2: 9.18.3

OPTIONAL BACKEND DEPENDENCIES

libpng: 1.2.31

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

OPTIONAL DATE/TIMEZONE DEPENDENCIES

datetime: present, version unknown

dateutil: 1.5

pytz: 2011c

OPTIONAL USETEX DEPENDENCIES

dvipng: no

ghostscript: 8.62

latex: no

pdftops: 0.12.3

==================

[Edit setup.cfg to suppress the above messages]

============================================================================

pymods [‘pylab’]

packages [‘matplotlib’, ‘matplotlib.backends’, ‘matplotlib.backends.qt4_editor’, ‘matplotlib.projections’, ‘matplotlib.testing’, 'matplotlib.testing.jpl_units

', ‘matplotlib.tests’, ‘mpl_toolkits’, ‘mpl_toolkits.mplot3d’, ‘mpl_toolkits.axes_grid’, ‘mpl_toolkits.axes_grid1’, ‘mpl_toolkits.axisartist’, 'matplotlib.sph

inxext’, ‘matplotlib.tri’, ‘matplotlib.delaunay’]

running build

running build_py

creating build

warnings of build

============

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

src/_ttconv.cpp: In function ‘void initttconv()’:

src/_ttconv.cpp:280:15: warning: variable ‘m’ set but not used [-Wunused-but-set-variable]

ttconv/pprdrv_tt.cpp: In function ‘void Read_name(TTFONT*)’:

ttconv/pprdrv_tt.cpp:182:18: warning: variable ‘encoding’ set but not used [-Wunused-but-set-variable]

ttconv/pprdrv_tt.cpp:183:9: warning: variable ‘language’ set but not used [-Wunused-but-set-variable]

ttconv/pprdrv_tt2.cpp: In member function ‘void GlyphToType3::do_composite(TTStreamWriter&, TTFONT*, unsigned char*)’:

ttconv/pprdrv_tt2.cpp:598:12: warning: variable ‘xscale’ set but not used [-Wunused-but-set-variable]

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

lib/matplotlib/delaunay/natneighbors.cpp: In member function 'void NaturalNeighbors::interpolate_grid(double*, double, double, int, double, double, int, doubl

e*, double, int)':

lib/matplotlib/delaunay/natneighbors.cpp:265:9: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

src/path.cpp: In function ‘void _add_polygon(Py::List&, const std::vector&)’:

src/path.cpp:1259:58: warning: narrowing conversion of ‘((& polygon)->std::vector<_Tp, _Alloc>::size<double, std::allocator >() / 2ul)’ from 'std::vec

tor::size_type {aka long unsigned int}’ to ‘npy_intp {aka long int}’ inside { } is ill-formed in C++11 [-Wnarrowing]

src/path.cpp: In function ‘void init_path()’:

src/path.cpp:1609:26: warning: variable ‘_path’ set but not used [-Wunused-but-set-variable]

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

lib/matplotlib/tri/_tri.cpp: In member function ‘void Triangulation::calculate_edges()’:

lib/matplotlib/tri/_tri.cpp:280:39: warning: narrowing conversion of 'edge_set.std::set<_Key, _Compare, _Alloc>::size<Triangulation::Edge, std::less<Triangula

tion::Edge>, std::allocatorTriangulation::Edge >()’ from ‘std::setTriangulation::Edge::size_type {aka long unsigned int}’ to ‘npy_intp {aka long int}’ ins

ide { } is ill-formed in C++11 [-Wnarrowing]

lib/matplotlib/tri/_tri.cpp: In member function ‘Py::Object TriContourGenerator::contour_to_segs(const Contour&)’:

lib/matplotlib/tri/_tri.cpp:574:39: warning: narrowing conversion of '(& line)->ContourLine::.std::vector<_Tp, _Alloc>::size<XY, std::allocator

()’ from ‘std::vector::size_type {aka long unsigned int}’ to ‘npy_intp {aka long int}’ inside { } is ill-formed in C++11 [-Wnarrowing]

lib/matplotlib/tri/_tri.cpp: In function ‘void init_tri()’:

lib/matplotlib/tri/_tri.cpp:993:23: warning: variable ‘triModule’ set but not used [-Wunused-but-set-variable]

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

src/backend_agg.cpp: In member function ‘Py::Object BufferRegion::to_string_argb(const Py::Tuple&)’:

src/backend_agg.cpp:151:20: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]

src/backend_agg.cpp: In member function ‘Py::Object RendererAgg::draw_quad_mesh(const Py::Tuple&)’:

src/backend_agg.cpp:1758:23: warning: variable ‘free_edgecolors’ set but not used [-Wunused-but-set-variable]

src/backend_agg.cpp: In member function ‘Py::Object RendererAgg::write_rgba(const Py::Tuple&)’:

src/backend_agg.cpp:1994:10: warning: variable ‘close_file’ set but not used [-Wunused-but-set-variable]

src/backend_agg.cpp: In function ‘void init_backend_agg()’:

src/backend_agg.cpp:2416:33: warning: variable ‘_backend_agg’ set but not used [-Wunused-but-set-variable]

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

src/_png.cpp: In function ‘void init_png()’:

src/_png.cpp:497:25: warning: variable ‘_png’ set but not used [-Wunused-but-set-variable]

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc

/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc

==================

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

···

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

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 <ben.root@…1304…> wrote:

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

[mailto:frank0734@…287…]

···

From: Liang Wang
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 <ben.root@…1304…> wrote:

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

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.moore2@…3928…> wrote:

From: Liang Wang
[mailto:frank0734@…287…]
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 <ben.root@…1304…> wrote:

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

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 <frank0734@…287…> 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.moore2@…3928…> wrote:

From: Liang Wang
[mailto:frank0734@…287…]
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 <ben.root@…1304…> wrote:

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

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 <frank0734@…287…> 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 <frank0734@…287…> 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.moore2@…3928…> wrote:

From: Liang Wang
[mailto:frank0734@…287…]
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 <ben.root@…1304…> wrote:

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