Error while running Backtrader tutorial

I tried to run the tutorial for Backtrader(execute_command section from From Usage Guide) and I hit an error message. The backtesting runs fine. Its just saving the pdf file of the plot that I am unable to get it working. I tried to change the matplotlib's matplotlibrc file in "/opt/conda/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc" to "Agg" but that doesn't help (Running it in Mac OS High Sierra)

The error message on Jupyter is:
HTTPError: ('500 Server Error: INTERNAL SERVER ERROR for url: http://houston/satellite/commands?cmd=python+%2Fcodeload%2Fbacktrader%2Fdual_moving_average.py&return_file=%2Ftmp%2Fbacktrader-plot.pdf', {'status': 'error', 'msg': 'please check logspout for stdout/stderr'})

The logspout message is
quantrocket_satellite_1|Traceback (most recent call last):
quantrocket_satellite_1| File "/codeload/backtrader/dual_moving_average.py", line 64, in
quantrocket_satellite_1| cerebro.plot(use='Agg', savefig=True, figfilename='/tmp/backtrader-plot.pdf')
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/site-packages/backtrader/cerebro.py", line 991, in plot
quantrocket_satellite_1| start=start, end=end,use=use)
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/site-packages/backtrader/plot/plot.py", line 167, in plot
quantrocket_satellite_1| fig = self.pinf.newfig(figid, numfig, self.mpyplot)
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/site-packages/backtrader/plot/plot.py", line 72,in newfig
quantrocket_satellite_1| fig = mpyplot.figure(figid + numfig)
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/site-packages/matplotlib/pyplot.py", line 535, in figure
quantrocket_satellite_1| **kwargs)
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 81, in new_figure_manager
quantrocket_satellite_1| return new_figure_manager_given_figure(num, figure)
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 89, in new_figure_manager_given_figure
quantrocket_satellite_1| window = Tk.Tk()
quantrocket_satellite_1| File "/opt/conda/lib/python3.6/tkinter/init.py", line 2017, in init
quantrocket_satellite_1| self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
quantrocket_satellite_1|_tkinter.TclError: no display name and no $DISPLAY environment variable
quantrocket_satellite_1|[pid: 15|app: 0|req: 10/34] 172.18.0.6 () {38 vars in 675 bytes} [Sun Jul 1 04:27:29 2018] POST /satellite/commands?cmd=python+%2Fcodeload%2Fbacktrader%2Fdual_moving_average.py&return_file=%2Ftmp%2Fbacktrader-plot.pdf => generated 70 bytes in 4335 msecs (HTTP/1.1 500) 2 headers in 90 bytes (1 switches on core 0)

Unfortunately backtrader removed the ability to save plots to file. Try installing a specific version of backtrader before the functionality was removed:

environment:
  PIP_INSTALL: 'https://codeload.github.com/backtrader/backtrader/zip/1.9.56.122'

`