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

Issue with server/headless environments #12

Closed
dkoslicki opened this issue Apr 9, 2020 · 3 comments
Closed

Issue with server/headless environments #12

dkoslicki opened this issue Apr 9, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@dkoslicki
Copy link
Owner

Running the code locally on a system with a GUI is no problem. But when trying to run on a server (running the same version of Ubuntu, but with no GUI), the following error is encountered:

$ python src/profile_to_plot.py -i data/prediction_multi.profile -g data/ground_truth_multi.profile -b test -s sample_0 genus
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, webgl, xcb.

Aborted (core dumped)

Much googling lead nowhere.

@dkoslicki dkoslicki added the bug Something isn't working label Apr 9, 2020
@luizirber
Copy link

This sounds like an issue with matplotlib defaulting to qt, you can try to add a matplotlibrc file like we do in sourmash: https://github.com/dib-lab/sourmash/blob/master/matplotlibrc

For conda it also helps to use matplotlib-base instead of matplotlib, I think it avoids bringing qt and all the Xorg libs (which also makes environments way smaller)

@dkoslicki
Copy link
Owner Author

Thanks for the suggestion @luizirber! I’ll give that a try (though I think ete3 brings in qt as well, so might be two issues to address).

@dkoslicki
Copy link
Owner Author

Turns out just adding os.environ['QT_QPA_PLATFORM']='offscreen' before importing matplotlib, seaborn, or ete3 did the trick. So no need to switch to matplotlib-base (though it may indeed make the env smaller, so may be worth doing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants