I have been through many post talking about this issue but haven't find anything working on my server. So I am working on a server, on which I don't have a sudo access. I am simply trying to produce plots with matplotlib but I get the infamous
TclError: no display name and no $DISPLAY environment variable
I tried this ;
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
# fake up some data
spread = np.random.rand(50) * 100
center = np.ones(25) * 50
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low), 0)
# basic plot
plt.boxplot(data) ##############Crash here
plt.savefig( 'output_filename.png' )
But I can't plot at all. Is there anyway to work around that,without involving installing system packages (I can pip install if needed). I am creating a command line tool for some other users so I need something without too much modification. I am using ipython for troubleshooting but get the same error when running with
python name_of_script.py
Thanks for looking into it.