Opened 10 years ago

Closed 10 years ago

#41449 closed defect (fixed)

py-ipython: ipython notebook does not support inline plots (ImportError: No module named _backend_agg)

Reported by: lpsinger (Leo Singer) Owned by: akitada@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc:
Port: py-ipython

Description

The IPython port (py27-ipython +notebook) does not support inline plots.

Start up IPython with:

$ ipython notebook --pylab=inline

Then, enter and execute the following code cell:

from matplotlib import pyplot as plt
import numpy as np
plt.plot(np.arange(10), np.arange(10))
plt.show()

One gets the following traceback:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-1505639dfc55> in <module>()
----> 1 from matplotlib import pyplot as plt
      2 import numpy as np
      3 plt.plot(np.arange(10), np.arange(10))

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
     96 
     97 from matplotlib.backends import pylab_setup
---> 98 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
     99 
    100 

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/__init__.pyc in pylab_setup()
     26     # imports. 0 means only perform absolute imports.
     27     backend_mod = __import__(backend_name,
---> 28                              globals(),locals(),[backend_name],0)
     29 
     30     # Things we pull in from all backends

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/kernel/zmq/pylab/backend_inline.py in <module>()
      8 # Third-party imports
      9 import matplotlib
---> 10 from matplotlib.backends.backend_agg import new_figure_manager, FigureCanvasAgg
     11 from matplotlib._pylab_helpers import Gcf
     12 

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py in <module>()
     36 from matplotlib.transforms import Bbox, BboxBase
     37 
---> 38 from matplotlib.backends._backend_agg import RendererAgg as _RendererAgg
     39 from matplotlib import _png
     40 

ImportError: No module named _backend_agg

Change History (1)

comment:1 Changed 10 years ago by seanfarley (Sean Farley)

Resolution: fixed
Status: newclosed

I fixed this a while ago. Should work now.

Note: See TracTickets for help on using tickets.