title: Importing pyplot in a Jupyter Notebook
body: <p>Running Python 2.7 and trying to get plotting to work the tutorials recommend the below command.</p>
  
  <pre><code>from matplotlib import pyplot as plt
  </code></pre>
  
  <p>Works fine when run from the command line</p>
  
  <pre><code>python -c "from matplotlib import pyplot as plt"
  </code></pre>
  
  <p>but I get an error when trying to run it inside a Jupyter Notebook.</p>
  
  <pre><code>---------------------------------------------------------------------------
  ImportError                               Traceback (most recent call last)
  &lt;ipython-input-21-1d1446f6fa64&gt; in &lt;module&gt;()
  ----&gt; 1 from matplotlib import pyplot as plt
  
  /usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py in &lt;module&gt;()
      112 
      113 from matplotlib.backends import pylab_setup
  --&gt; 114 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
      115 
      116 _IP_REGISTERED = None
  
  /usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.pyc in pylab_setup()
       30     # imports. 0 means only perform absolute imports.
       31     backend_mod = __import__(backend_name,
  ---&gt; 32                              globals(),locals(),[backend_name],0)
       33 
       34     # Things we pull in from all backends
  
  /usr/local/lib/python2.7/dist-packages/ipykernel/pylab/backend_inline.py in &lt;module&gt;()
      154         configure_inline_support(ip, backend)
      155 
  --&gt; 156 _enable_matplotlib_integration()
  
  /usr/local/lib/python2.7/dist-packages/ipykernel/pylab/backend_inline.py in _enable_matplotlib_integration()
      152     backend = get_backend()
      153     if ip and backend == 'module://%s' % __name__:
  --&gt; 154         configure_inline_support(ip, backend)
      155 
      156 _enable_matplotlib_integration()
  
  /usr/local/lib/python2.7/dist-packages/IPython/core/pylabtools.pyc in configure_inline_support(shell, backend)
      359     except ImportError:
      360         return
  --&gt; 361     from matplotlib import pyplot
      362 
      363     cfg = InlineBackend.instance(parent=shell)
  
  ImportError: cannot import name pyplot
  </code></pre>
  
  <p>The following command works</p>
  
  <pre><code>import matplotlib
  </code></pre>
  
  <p>But the following gives me a similar error</p>
  
  <pre><code>import matplotlib.pyplot
  </code></pre>