Bug #4188
openmakeDEAlignedSum.py requires display setting to produce summary image
0%
Description
Our alignment clussterm runs headless.
Running from command line without ssh -X gives
Traceback (most recent call last): File "/opt/myamisnap/bin/makeDEAlignedSum.py", line 3, in <module> from appionlib import makeDEAlignedSumLib File "/opt/myamisnap/lib/appionlib/makeDEAlignedSumLib.py", line 10, in <module> from matplotlib import pyplot File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module> new_figure_manager, draw_if_interactive, show = pylab_setup() File "/usr/lib64/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 8, in <module> import gtk; gdk = gtk.gdk File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module> _init() File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init _gtk.init_check() RuntimeError: could not open display
Updated by Scott Stagg over 8 years ago
Ugh. Well, I guess matplotlib isn't going to work. I'm on vacation for a week, so Anchi can you just make the skip_summary_image option True all the time for now until I can figure out a better solution?
Updated by Anchi Cheng over 8 years ago
- Assignee changed from Anchi Cheng to Scott Stagg
r19778 is an workaround to avoid importing pyplot unless the image is produced and only make summary image when requested until it is properly fixed.
Enjoy the vacation
Updated by Anchi Cheng over 8 years ago
apCtf.ctfdisplay would have the same problem. Will need a solution.
Updated by Anchi Cheng over 8 years ago
Comment from Bill Rice
Looks like replace gtk_init with __gtk_init_check() should solve the problem: from https://developer.gnome.org/gtk3/stable/gtk3-General.html#gtk-init-check gtk_init_check (int argc, char **argv); This function does the same work as gtk_init() with only a single change: It does not terminate the program if the windowing system can’t be initialized. Instead it returns FALSE on failure. This way the application can fall back to some other means of communication with the user - for example a curses or command line interface.
The main issue is that appionPBS.py runs on head node. so far the terminal never close, but Bill and future users will be doing remote log in and -X option does not allow nohup since it will lose the terminal. apCtf.ctfdisplay does not have this issue because it would be executed through the submitted job.
Updated by Neil Voss over 8 years ago
The only display ctfdisplay needs is matplotlib, I use the line:
from matplotlib import use use('Agg') from matplotlib import pyplot
to avoid the gtk requirement.