ETE: cannot connect to X server

998 views
Skip to first unread message

Jing Lu

unread,
Sep 27, 2013, 6:13:54 PM9/27/13
to eteto...@googlegroups.com
I have nothing wrong when I run my code on my own ubuntu desktop. But when I run it on my server, I got such error:

ETE: cannot connect to X server (#server-name):0.0

Here is my code to draw the tree.

    def drawTree( self ):
        ts = ete2.TreeStyle()
        ts.mode = "c"
        ts.layout_fn = self.my_layout
        t = self.prepareTree() # my own function
        t.render("mytree.svg", tree_style=ts)

The error seems to be relevant to xhost. I have try "xhost +local:myusername" without root permission, and xhost return error:

xhost: unable to open display "#servername:0.0"

What can I do with it?

Thanks,
Jing

Salvador Capella

unread,
Sep 28, 2013, 2:42:45 AM9/28/13
to eteto...@googlegroups.com
Dear Jing,

Something I experience same error with any script using xserver to generate plots on a remote computer.
In order to solve it, I make an export and then everything is working, could you give a try?
export DISPLAY=local_host:0.0
It's pretty simple but it may helps.

S


--
You received this message because you are subscribed to the Google Groups "The ETE toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etetoolkit+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
S

Jing Lu

unread,
Sep 28, 2013, 12:08:50 PM9/28/13
to eteto...@googlegroups.com
Dear Scapella,
 
That is the righ way of solution. But I got a similar error:
 
ETE: cannot connect to X server local_host:0.0
I am thinking whether I should install something to support X server.
 
 
Thanks,
Jing

Jaime Huerta Cepas

unread,
Sep 30, 2013, 3:57:47 AM9/30/13
to eteto...@googlegroups.com
Hi Jing,

First, you will need to have a xserver runnning on your remote machine. I assume you have it, so can run any other graphical application, i.e. xclock.

Second, there are a couple of tweaks you may need to add to your xserver: One is the "xhost +" (allowing any user to connect to the display) and the other will depend on your display manager. For instance, xdm requires changing one or two lines in its config file.
You can check it here: http://pythonhosted.org/ete2/tutorial/tutorial_webplugin.html#installing-a-x-server

Basically, you will need to get support for graphical applications in your server. As far as you can run xclock or any other app, you should run ETE without problems.

I hope it helps. Let us know how it goes

bw
Jaime

Jing Lu

unread,
Sep 30, 2013, 4:43:48 PM9/30/13
to eteto...@googlegroups.com, jhu...@crg.es
Hi Jaime,

Yes, now it is working. I did not have X forwarding setting correctly. 

Now ete gave me a lot of QPainter error, as the picture is very large to draw. Anyway to fix that?


Thanks,
Jing

Jaime Huerta Cepas

unread,
Sep 30, 2013, 5:35:46 PM9/30/13
to eteto...@googlegroups.com

Only way is to render the image as svg or pdf format.  same render function, just change output file extension.

bw
Jaime

Jing Lu

unread,
Sep 30, 2013, 10:46:45 PM9/30/13
to eteto...@googlegroups.com, jhu...@crg.es
Thanks! Jaime

So any nice svg viewer for a large svg file? I found Adobe SVG viewer and Adobe Illustrator, but I am not sure whether those are good for hundreds of nodes and face figures.

For pdf, do I need to set the width and height also?

Best,
Jing

Jaime Huerta Cepas

unread,
Oct 1, 2013, 5:35:14 AM10/1/13
to eteto...@googlegroups.com
So any nice svg viewer for a large svg file? I found Adobe SVG viewer and Adobe Illustrator, but I am not sure whether those are good for hundreds of nodes and face figures.

If your tree images are really huge, hardware will be even more important than the software. I use Inkscape, but it does not really move very smoothly when huge trees are loaded. 
Note also that modern browsers, such as Chrome, have excellent support for SVG. You can try to use them to visualize your figures. 
 
For pdf, do I need to set the width and height also?
Yeas, the image will be scale to the provided size. I recommend you to fix only width or height, but not both, so the scaling factor will be guess and the figure will keep the original aspect ratio.

bw
jaime 
Reply all
Reply to author
Forward
0 new messages