Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETE: cannot connect to X server #101

Closed
JohnReid opened this issue Apr 23, 2015 · 19 comments
Closed

ETE: cannot connect to X server #101

JohnReid opened this issue Apr 23, 2015 · 19 comments

Comments

@JohnReid
Copy link

ETE exits python when I try to render a tree without an X server. This is a real shame as I want to run it on a server (without X) to serve tree images from. Is there any way around this?

@jhcepas
Copy link
Member

jhcepas commented Apr 23, 2015

Sorry, this is a known issue. The only way to get the renderer working is having an X server. It is actually a limitation of Qt4, which ETE uses for drawing. A minimal X system would be enough, or even using a forwarded X display.

We know this is quite annoying and we are working on an Qt4-free renderer.

@JohnReid
Copy link
Author

Thanks for the reply. Is it possible for it to raise an Exception rather than exit python? I might try to use xvfb as a headless dummy Xserver.

@jhcepas
Copy link
Member

jhcepas commented Apr 24, 2015

The exit call seems to be raised by qt4, so all we can do is to check before importing the library. Shouldn't be difficult, I will look into it.

Let us know if xvfb works, never tried before.
Thanks!

@JohnReid
Copy link
Author

xvfb worked a dream. After installation as an Ubuntu package, I could just preface my webserver command line with xvfb-run and a dummy Xserver was created that allowed ete2 to render my images. Thanks for ete2 and the feedback on this issue.

@matsen
Copy link
Contributor

matsen commented Dec 10, 2015

This worked great for me. Thanks, @JohnReid !

@gregcaporaso
Copy link

check before importing the library

@jhcepas, could you describe how you would do that check? I'm building some plots as part of IAB, and when I execute my tests via TravisCI they fail due to the missing xserver. I'd like to just check and skip rendering the plots if the xserver isn't available.

Thanks!

@gregcaporaso
Copy link

I got this working in my TravisCI build by starting the xserver there (thanks for the tip @jairideout!). Here's how I'm doing that, in case it's useful for others.

@jhcepas
Copy link
Member

jhcepas commented Mar 29, 2016

@gregcaporaso , we use xvfb also under TravisCI

- "sh -e /etc/init.d/xvfb start"

@mgalardini
Copy link

Hi,

just wanted to state my support to find an alternate renderer that doesn't rely on an X server; I would have problems to run xvfb on our cluster, so something that is less of a workaround would be preferable.

Thanks for the great work.
Marco

@anatoly108
Copy link

anatoly108 commented Apr 25, 2017

Well, despite our best efforts we couldn't use ETE on Amazon EC2 instance because it relies on X server. For us this is the reason to forget ETE

@jhcepas
Copy link
Member

jhcepas commented Apr 25, 2017

I just tried the following commands on an Amazon EC2 instance running Ubuntu server 14.04.2 LTS:

apt-get install xvfb
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O Miniconda-latest-Linux-x86_64.sh
bash Miniconda-latest-Linux-x86_64.sh -b -p ~/anaconda_ete/
export PATH=~/anaconda_ete/bin:$PATH; 
conda install -c etetoolkit ete3 ete3_external_apps
xvfb-run ete3 view -t '(a, b); ' -o test.png

and everything ran ok. No need of an X server.

@andrewsanchez
Copy link

Here is a success story for compiling xvfb without root access on RHEL:
https://ericdraken.com/running-xvfb-on-a-shared-host-without-x/

@thdpuydt
Copy link

This fix from following anaconda thread works for me:

ContinuumIO/anaconda-issues#1806

In [1]: import os
In [2]: os.environ['QT_QPA_PLATFORM']='offscreen'
In [3]: import ete3

@andrewsanchez
Copy link

Any idea how to suppress the error output that results from running with this setting (as discussed at ContinuumIO/anaconda-issues#1806) on a remote server with no x server or x 11 forwarding?

  • os.environ['QT_QPA_PLATFORM']='offscreen'

Here is the error output I get:

QFontDatabase: Cannot find font directory ~/miniconda3/envs/env/lib/fonts - is Qt installed correctly?

@jhcepas
Copy link
Member

jhcepas commented Jul 30, 2018 via email

@andrewsanchez
Copy link

andrewsanchez commented Jul 30, 2018 via email

@jhcepas
Copy link
Member

jhcepas commented Jul 31, 2018

I see, then I am afraid that you will need xvfb. At least I could not find any other way.
Even SVG features in ete3 use Qt directives, and Qt requieres an xserver to work.

@orangeSi
Copy link

orangeSi commented Nov 15, 2018

Any idea how to suppress the error output that results from running with this setting (as discussed at ContinuumIO/anaconda-issues#1806) on a remote server with no x server or x 11 forwarding?

  • os.environ['QT_QPA_PLATFORM']='offscreen'

Here is the error output I get:

QFontDatabase: Cannot find font directory ~/miniconda3/envs/env/lib/fonts - is Qt installed correctly?

I solved this error by

download https://github.com/openwebos/qt/tree/master/lib/fonts to get fonts directory 
mv fonts to xx/envs/your_envname/lib/

@wsdewitt
Copy link

wsdewitt commented Mar 8, 2022

As an alternative to XVFB, I've had had success setting the following environment variables:

export QT_QPA_PLATFORM=offscreen
export XDG_RUNTIME_DIR=/tmp/runtime-runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants