And
matplotlib.use('Agg')

Would only work before matplotlib is first used so you would need to restart 
the interpreter. From error stack below it looks like something might be 
setting the default backend in matplotlib to TkAgg though.

Are you using the Python interpreter or PySpark interpreter? Also how you are 
calling matplotlib like Moon asks?

_____________________________
From: moon soo Lee <m...@apache.org<mailto:m...@apache.org>>
Sent: Tuesday, September 13, 2016 2:34 PM
Subject: Re: Matplotlib uses tkinter instead of Agg
To: <users@zeppelin.apache.org<mailto:users@zeppelin.apache.org>>


Hi,

Thanks for sharing the problem.
Could you share which version of Zeppelin are you using and how did you try 
matplotlib inside of Zeppelin? Are you trying matplotlib with z.show() ?

Thanks,
moon

On Tue, Sep 13, 2016 at 1:56 AM Xi Shen 
<davidshe...@gmail.com<mailto:davidshe...@gmail.com>> wrote:
Hi,

I want to build a Zeppelin docker image for my self. The docker image is based 
on ubuntu:wily, and has openjdk-8-jre and python3 installed. I also installed 
other packages that I need.

After started Zeppelin in the docker, I am able to access the webapp from my 
local browser. I tried to execute some simple Python script, and it works fine. 
But when I try to run the matplotlib example, I got error saying that tkinter 
cannot find the $DISPLAY.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/matplotlib/pyplot.py", line 535, 
in figure
**kwargs)
File 
"/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_tkagg.py", 
line 84, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File 
"/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_tkagg.py", 
line 92, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python3.4/tkinter/__init__.py", line 1859, in __init__
self.tk<http://self.tk> = _tkinter.create(screenName, baseName, className, 
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

Some people on the Internet suggested adding matplotlib.use('Agg') at the 
beginning of the notebook, but it still does not work for me.

--

Thanks,
David S.


Reply via email to