TclError: no display name and no $DISPLAY environment variable on Windows 10 Bash
<p>I tried to install matplotlib on Windows 10 Bash shell.</p>

<p>After that, I ran following lines:</p>

<pre><code>$ ipython3
</code></pre>

<p>then</p>

<pre><code>In[1]: %pylab
</code></pre>

<p>then it gives me a following error:</p>

<pre><code>---------------------------------------------------------------------------
TclError                                  Traceback (most recent call last)
&lt;ipython-input-1-4ab7ec3413a5&gt; in &lt;module&gt;()
----&gt; 1 get_ipython().magic('pylab')

/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
   2164         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2165         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-&gt; 2166         return self.run_line_magic(magic_name, magic_arg_s)
   2167
   2168     #-------------------------------------------------------------------------

/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
   2085                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2086             with self.builtin_trap:
-&gt; 2087                 result = fn(*args,**kwargs)
   2088             return result
   2089

/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py in pylab(self, line)

/usr/lib/python3/dist-packages/IPython/core/magic.py in &lt;lambda&gt;(f, *a, **k)
    190     # but it's overkill for just that one bit of state.
    191     def magic_deco(arg):
--&gt; 192         call = lambda f, *a, **k: f(*a, **k)
    193
    194         if isinstance(arg, collections.Callable):

/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py in pylab(self, line)
    129             import_all = not args.no_import_all
    130
--&gt; 131         gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
    132         self._show_matplotlib_backend(args.gui, backend)
    133         print ("Populating the interactive namespace from numpy and matplotlib")

/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in enable_pylab(self, gui, import_all, welcome_message)
   2918         from IPython.core.pylabtools import import_pylab
   2919
-&gt; 2920         gui, backend = self.enable_matplotlib(gui)
   2921
   2922         # We want to prevent the loading of pylab to pollute the user's

/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
   2879                 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
   2880
-&gt; 2881         pt.activate_matplotlib(backend)
   2882         pt.configure_inline_support(self, backend)
   2883

/usr/lib/python3/dist-packages/IPython/core/pylabtools.py in activate_matplotlib(backend)
    244     matplotlib.rcParams['backend'] = backend
    245
--&gt; 246     import matplotlib.pyplot
    247     matplotlib.pyplot.switch_backend(backend)
    248

/usr/local/lib/python3.4/dist-packages/matplotlib/pyplot.py in &lt;module&gt;()
   2510 # are no-ops and the registered function respect `mpl.is_interactive()`
   2511 # to determine if they should trigger a draw.
-&gt; 2512 install_repl_displayhook()
   2513
   2514 ################# REMAINING CONTENT GENERATED BY boilerplate.py ##############

/usr/local/lib/python3.4/dist-packages/matplotlib/pyplot.py in install_repl_displayhook()
    163             ipython_gui_name = backend2gui.get(get_backend())
    164             if ipython_gui_name:
--&gt; 165                 ip.enable_gui(ipython_gui_name)
    166         else:
    167             _INSTALL_FIG_OBSERVER = True

/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py in enable_gui(gui, app)
    306         from IPython.lib.inputhook import enable_gui as real_enable_gui
    307         try:
--&gt; 308             return real_enable_gui(gui, app)
    309         except ValueError as e:
    310             raise UsageError("%s" % e)

/usr/lib/python3/dist-packages/IPython/lib/inputhook.py in enable_gui(gui, app)
    526         e = "Invalid GUI request %r, valid ones are:%s" % (gui, list(guis.keys()))
    527         raise ValueError(e)
--&gt; 528     return gui_hook(app)
    529

/usr/lib/python3/dist-packages/IPython/lib/inputhook.py in enable_tk(self, app)
    322         if app is None:
    323             import tkinter
--&gt; 324             app = tkinter.Tk()
    325             app.withdraw()
    326             self._apps[GUI_TK] = app

/usr/lib/python3.4/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
   1852                 baseName = baseName + ext
   1853         interactive = 0
-&gt; 1854         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
   1855         if useTk:
   1856             self._loadtk()

TclError: no display name and no $DISPLAY environment variable
</code></pre>

<p>I'd appreciate if anybody can point out how to remove this error. Thank you.</p>

<p>There is no official display environment for bash on Windows. </p>

<ul>
<li>You need to install unoffical display environment, i.e. xming (<a href="https://sourceforge.net/projects/xming/" rel="nofollow">https://sourceforge.net/projects/xming/</a>)</li>
<li>After installing xming you need to export as <strong>DISPLAY=:0</strong>. </li>
<li>You also need to install qtconsole. <strong>sudo apt-get install qtconsole</strong></li>
</ul>

<p>However, I don't suggest going in this way, there is a much easier way for using ipython on Windows. You can install Anaconda on Windows and you can use ipython without any problems like this (<a href="https://www.continuum.io/downloads" rel="nofollow">https://www.continuum.io/downloads</a>) </p>

python matplotlib