askap-craco / CELEBI

The CRAFT Effortless Localisation and Enhanced Burst Inspection Pipeline
MIT License
4 stars 2 forks source link

No display name, $Display environment variable #448

Closed marcinglowacki closed 1 year ago

marcinglowacki commented 1 year ago

Matplotlib issue in the plotting stage of htr (beamforming) steps:

_Command error:

Due to MODULEPATH changes, the following have been reloaded: 1) sqlite/3.21.0

Traceback (most recent call last): File "/fred/oz002/askap/craft/craco/CELEBI/craco_postproc/pipelines/../beamform//plot.py", line 177, in _main() File "/fred/oz002/askap/craft/craco/CELEBI/craco_postproc/pipelines/../beamform//plot.py", line 13, in _main plot(args, fnames) File "/fred/oz002/askap/craft/craco/CELEBI/craco_postproc/pipelines/../beamform//plot.py", line 173, in plot plot_IQUV_dts(stks, args.f, labels=["I", "Q", "U", "V"], fname=f"{args.label}_IQUVdts{args.DM}.png") File "/fred/oz002/askap/craft/craco/CELEBI/craco_postproc/pipelines/../beamform//plot.py", line 83, in plot_IQUV_dts fig = plt.figure(figsize=(2.5 len(facs), 2.5 len(ds_list))) File "/apps/skylake/software/compiler/gcc/6.4.0/matplotlib/2.2.2-python-3.6.4/lib/python3.6/site-packages/matplotlib-2.2.2-py3.6-linux-x86_64.egg/matplotlib/pyplot.py", line 548, in figure **kwargs) File "/apps/skylake/software/compiler/gcc/6.4.0/matplotlib/2.2.2-python-3.6.4/lib/python3.6/site-packages/matplotlib-2.2.2-py3.6-linux-x86_64.egg/matplotlib/backend_bases.py", line 161, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig) File "/apps/skylake/software/compiler/gcc/6.4.0/matplotlib/2.2.2-python-3.6.4/lib/python3.6/site-packages/matplotlib-2.2.2-py3.6-linux-x86_64.egg/matplotlib/backends/_backend_tk.py", line 1044, in new_figure_manager_given_figure window = Tk.Tk(className="matplotlib") File "/apps/skylake/software/compiler/gcc/6.4.0/python/3.6.4/lib/python3.6/tkinter/init.py", line 2017, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable

Work dir: /fred/oz002/askap/craft/craco/processing/work/210912/e4/7f772a26822fb760ae161e2544914f_

The solution: specify

"import matplotlib as mpl mpl.use('agg')"

at the top of the plot.py script used, to force the pipeline away from using an interactive backend by default.