I am running a python script on a remote machine, which runs fine, but soon after starting I get the warning:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-myusername'
I didn't worry about this warning as it wasn't stopping my code.
I then tried to submit the same code using Slurm workload manager, using the command:
sbatch --wrap="python mycode.py" -N 1 --cpus-per-task=8 -o mycode.o
When I do this, the code doesn't work, and I get the following error:
Traceback (most recent call last):
File "mycode.py", line 99, in <module>
fig=plt.figure(figsize=(20, 12), dpi = 100, facecolor='w', edgecolor='k')
File "/home/myusername/miniconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 539, in figure
**kwargs)
File "/home/myusername/miniconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3252, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/myusername/miniconda3/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 946, in new_figure_manager_given_figure
window = tk.Tk(className="matplotlib")
File "/home/myusername/miniconda3/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)_tkinter.TclError: couldn't connect to display "localhost:36.0"
Obvious the error is something to do with a figure I am producing. I'm not sure if it is related to the XDG_RUNTIME_DIR warning.
Any help would be appreciated.