Error TclError: no display name and no $DISPLAY environment variable


I use matplotlib as part of my Trac plugin. I got this error when I try to access the web site that use my plugin. Please see the trace back below

File “/u/bhuricha/lib/python2.5/site-packages/Trac-
0.11dev_r5933-py2.5.egg/trac/web/”, line 381, in dispatch_request
File “/u/bhuricha/lib/python2.5/site-packages/Trac-0.11dev_r5933-py2.5.egg/trac/web/”, line 191, in dispatch
File “/u/bhuricha/source/trac-hacks/tracmetrixplugin/0.11/tracmetrixplugin/”, line 119, in process_request

File “/u/bhuricha/source/trac-hacks/tracmetrixplugin/0.11/tracmetrixplugin/”, line 193, in _render_view
File “/u/bhuricha/source/trac-hacks/tracmetrixplugin/0.11/tracmetrixplugin/”, line 452, in get_daily_backlog_chart

File “/usr/lib/python2.5/site-packages/matplotlib/”, line 876, in figure
File “/usr/lib/python2.5/site-packages/matplotlib/backends/”, line 88, in new_figure_manager
File “lib-tk/”, line 1639, in init

Local variables:
Name Value
baseName ‘trac.cgi’
className ‘Tk’
ext ‘.cgi’
interactive 0
os <module ‘os’ from ‘/usr/lib/python2.5/os.pyc’>

screenName None
self None
sync 0
sys <module ‘sys’ (built-in)>
use None
useTk 1

I am not sure what’s wrong. I was able to get this to work in the different environment. Can anyone tell me what might be wrong?