install problem

------------------------------------------------------------------------

    > elcorto@...662...:~/Install/Matplotlib/matplotlib-0.86.2$ sudo
    > python setup.py install installing data to
    > lib/python2.3/site-packages/matplotlib/mpl-data pygtk
    > present but import failed 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.

    > Gtk-WARNING **: cannot open display:
    > ------------------------------------------------------------------------

This is an annoyance that is caused by the fact that the GTK install
needs an X11 connection, and in some setups when you install as root
the root user does not have access to your display. I usually install
as suso: do you have sudo setup? Basically, you need to be able to
make sure you can launch an X11 app (eg xterm) in the environment that
you are running matplotlib install.

Perhaps some UNIX guru can give the proper incantation. In addition
to setting the DISPLAY as root, you may need to check your xhost
settings.

JDH

John Hunter wrote:

This is an annoyance that is caused by the fact that the GTK install
needs an X11 connection,

Is it really necessary to import GTK when installing MPL? why? I think getting rid of that requirement would be the best fix.

Basically, you need to be able to
make sure you can launch an X11 app (eg xterm) in the environment that
you are running matplotlib install.

Perhaps some UNIX guru can give the proper incantation.

I've done it, but I'm not sure I remember how at the moment. But try something like:

xhost +root

or even:

xhost +

which I think lets anyone have access to the Xserver.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Christopher Barker wrote:

John Hunter wrote:

This is an annoyance that is caused by the fact that the GTK install
needs an X11 connection,

Is it really necessary to import GTK when installing MPL? why? I think getting rid of that requirement would be the best fix.

Basically, you need to be able to
make sure you can launch an X11 app (eg xterm) in the environment that
you are running matplotlib install.

Perhaps some UNIX guru can give the proper incantation.

I've done it, but I'm not sure I remember how at the moment. But try something like:

xhost +root

or even:

xhost +

which I think lets anyone have access to the Xserver.

-Chris

I've replied to only to John, not the list. Here is the mail again:

···

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

John Hunter wrote:

>
> > ------------------------------------------------------------------------
> > elcorto@...662...:~/Install/Matplotlib/matplotlib-0.86.2$ sudo
> > python setup.py install installing data to
> > lib/python2.3/site-packages/matplotlib/mpl-data pygtk
> > present but import failed 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.
>
> > Gtk-WARNING **: cannot open display:
> > ------------------------------------------------------------------------
>
> This is an annoyance that is caused by the fact that the GTK install
> needs an X11 connection, and in some setups when you install as root
> the root user does not have access to your display.

Exactly this was the problem. I was logged in from machine A on machine B as user (ssh -X B) and wanted to install on B. So what I did on B was:

(as user):
user@...1000...:<mpl_path>$ python setup.py build # this works

(via sudo):
user@...1000...:<mpl_path>$ sudo python setup.py install
python setup.py install installing data to
lib/python2.3/site-packages/matplotlib/mpl-data
pygtk present but import failed
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.

Gtk-WARNING **: cannot open display:

(becoming su):
user@...1000...:<mpl_path>$ su
user@...1000...:<mpl_path># python setup.py install
X11 connection rejected because of wrong authentication.
The application 'setup.py' lost its connection to the display localhost:10.0;
most likely the X server was shut down or you killed/destroyed
the application.

> I usually install
> as suso: do you have sudo setup? Basically, you need to be able to
> make sure you can launch an X11 app (eg xterm) in the environment that
> you are running matplotlib install.

Right, I can't open an X app on B via sudo or beeing su. Unfortunalelly I don't understand enough of the X-permission/xhost stuff to get this right :slight_smile:

> Perhaps some UNIX guru can give the proper incantation.

He did. Finally I logged in as root (ssh -X root@...1000...) and then everthing
went fine.

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

Additionally, if you want to install directly on A or B (not beeing logged in via ssh) just open a root terminal and install as usual. sudo and su won't do it.

cheers,
steve

--
Random number generation is the art of producing pure gibberish as quickly as possible.