Question

I recently switched to the EPD version of ipython (I have the 64-bit student edition), and now I'm having trouble with pylab. When I type "import pylab" it gives me the following error

ImportError                               Traceback (most recent call last)
<ipython-input-1-0c66bb86b884> in <module>()
----> 1 import pylab

/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/pylab.py in <module>()
----> 1 from matplotlib.pylab import *
      2 import matplotlib.pylab
      3 __doc__ = matplotlib.pylab.__doc__

/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/pylab.py in <module>()
    219      silent_list, iterable, dedent
    220 
--> 221 from matplotlib import mpl  # pulls in most modules
    222 
    223 from matplotlib.dates import date2num, num2date,\

/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/mpl.py in <module>()
      1 from matplotlib import artist
----> 2 from matplotlib import axis
      3 from matplotlib import axes
      4 from matplotlib import cbook
      5 from matplotlib import collections

/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/axis.py in <module>()
      8 from matplotlib.artist import allow_rasterization
      9 import matplotlib.cbook as cbook
---> 10 import matplotlib.font_manager as font_manager
     11 import matplotlib.lines as mlines
     12 import matplotlib.patches as mpatches

/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/font_manager.py in <module>()
     50 import matplotlib
     51 from matplotlib import afm
---> 52 from matplotlib import ft2font
     53 from matplotlib import rcParams, get_configdir
     54 from matplotlib.cbook import is_string_like

ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so

I need pylab/matplotlib to live, so this is bad. Interestingly enough, when I double click on PyLab (64-bit).app in my /Applications/Enthought/ folder it opens up a terminal and pylab runs fine, it just doesn't work when I call it from the command line, or when I use notebook. If I could get python to use the version of pylab that I got from EPD then everything would be fine, but by default it imports the thing from /Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ where something is wrong with ft2font.so.

Was it helpful?

Solution

Looks like a conflict between your EPD python and the packages that you installed with Apple's python.

1) As tsyu80 indicates, your PATH may be pointing you to Apple's python, so you may be starting its ipython rather than EPD's. If this is the case, adding the following lines to your ~/.bash_profile file should fix this (though these lines should already have been added during EPD installation)

# Setting PATH for EPD-7
PATH="/Library/Frameworks/EPD64.framework/Versions/Current/bin:${PATH}"
export PATH

Note that you should a new Terminal session to have these settings take effect.

2) Even if you start EPD's (i)python, it may be importing from packages installed in Apple's. See https://support.enthought.com/entries/22094157-OS-X-Conflict-with-installed-packages-in-earlier-Python-installation

3) Once you resolve this issue, be sure to update to the latest version of ipython: https://support.enthought.com/entries/22415022-Using-enpkg-to-update-EPD-packages

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top