title: Error only when submitting python job in Slurm
body: <p>I am running a python script on a remote machine, which runs fine, but soon after starting I get the warning:</p>
  
  <pre><code>QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-myusername'
  </code></pre>
  
  <p>I didn't worry about this warning as it wasn't stopping my code.</p>
  
  <p>I then tried to submit the same code using Slurm workload manager, using the command:</p>
  
  <pre><code>sbatch --wrap="python mycode.py" -N 1 --cpus-per-task=8 -o mycode.o
  </code></pre>
  
  <p>When I do this, the code doesn't work, and I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "mycode.py", line 99, in &lt;module&gt;
      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"
  </code></pre>
  
  <p>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.</p>
  
  <p>Any help would be appreciated.</p>