I have to VPN and then ssh from home to my work server and want to run a python script in the background, then log out of the ssh session. My script makes several histogram
It looks like you're running in interactive mode by default, so matplotlib wants to plot everything to the screen first, which of course it can't do.
Try putting
ioff()
at the top of your script, along with making the backend change.
reference: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ioff