fonnesbeck/ScipySuperpack

ImportError ft2font in /Users/fonnescj/Code/lib/libfreetype.6.dylib

Closed this issue · 27 comments

Using the head version (51de317) of scipysuperpack on 10.7:

      File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/figure.py", line 19, in <module>
        from axes import Axes, SubplotBase, subplot_class_factory
      File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axes.py", line 14, in <module>
        import matplotlib.axis as maxis
      File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axis.py", line 10, in <module>
        import matplotlib.font_manager as font_manager
      File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/font_manager.py", line 53, in <module>
        from matplotlib import ft2font
    ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so, 2): Library not loaded: /Users/fonnescj/Code/lib/libfreetype.6.dylib
      Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
      Reason: image not found

I had to install using 4db963b to get it to work.

Sorry, misread your post. The fix should be below.

Hello, I am experiencing a similar problem on 10.8:

>>> from matplotlib import axis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/font_manager.py", line 53, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so, 2): Library not loaded: /Users/fonnescj/Code/lib/libfreetype.6.dylib
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
  Reason: image not found

Am I doing something wrong?

No, that's a linking error on my part. Stay tuned.

OK, should be fixed now in 05f847e. Give it a try.

Hey, thanks for the quick response!

I still get (another) error now:

>>> from matplotlib import axis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/font_manager.py", line 53, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so, 2): Symbol not found: _BZ2_bzDecompress
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so

It sounds like you are running 32-bit Python. Can you check?

Apparently it's 64 bit (should be the stock Python shipping with ML):

$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

$ python -c 'import sys;print("%x" % sys.maxsize, sys.maxsize > 2**32)'
('7fffffffffffffff', True)

Oh, it's a universal binary:

$ file `which python`
/usr/bin/python: Mach-O universal binary with 2 architectures
/usr/bin/python (for architecture i386):    Mach-O executable i386
/usr/bin/python (for architecture x86_64):  Mach-O 64-bit executable x86_64

So, if you run python using arch -x86_64 python, does matplotlib import without error?

Nope, I get the exact same:

$ arch -x86_64 python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import axis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/font_manager.py", line 53, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so, 2): Symbol not found: _BZ2_bzDecompress
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
>>> 

When you type:

import sys; sys.maxint

what do you get?

$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.maxint
9223372036854775807
>>> 

$ arch -x86_64 python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.maxint
9223372036854775807
>>> 

Give this one a try:

sudo easy_install https://dl.dropbox.com/u/233041/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg

Still no luck :(

$ sudo easy_install https://dl.dropbox.com/u/233041/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg
Password:
Downloading https://dl.dropbox.com/u/233041/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg
Processing matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg
Extracting matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
matplotlib 1.2.x is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg
Processing dependencies for matplotlib==1.2.x
Finished processing dependencies for matplotlib==1.2.x

$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import axis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/font_manager.py", line 53, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so, 2): Symbol not found: _BZ2_bzDecompress
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so
cwiz commented

same issue with me. tried both dropbox egg and master
mountain lion with 2.7.2 python

OK, let me know if the following does not fix it:

sudo easy_install https://dl.dropbox.com/u/233041/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg

Thanks for your hard work on this, fonnesbeck!

Unfortunately, I still get the same error. Did you build with -lbz2?

ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/ft2font.so, 2): Symbol not found: _BZ2_bzDecompress

OK, one more try. You know the drill:

sudp easy_install https://dl.dropbox.com/u/233041/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg
>>> from matplotlib import axis
>>> 

Woo-hoo!! Thank you so much, apparently it's working now!

That's excellent news. Thanks for helping me track it down.

I'm getting an import error with ft2font as well, but slightly different. It seems to be something with X11, but I haven't been able to find a fix. Any ideas?

>>> from matplotlib import ft2font
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so, 2): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so
  Reason: Incompatible library version: ft2font.so requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0

It looks like its trying to load your dynamic library at /usr/X11/lib/libfreetype.6.dylib If you move this file, does the problem go away?

It does not. It's a system file, so this likely isn't a ScipySuperpack problem, but thought someone here might have run into the same issue. I'm on OSX 10.7.2.

>>> from matplotlib import ft2font
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so, 2): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so
  Reason: image not found

Apparently it was an issue with versioning in the system files - downloading and installing all OSX system updates provides the fix.

>>> from matplotlib import ft2font
>>> 

Hello fonnesbeck, I pretty much had the exact same errors as hoechenberger did above. However when trying to apply your last fix (sudp easy_install https://dl.dropbox.com/u/233041/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg) it seems to hang forever. When trying to hit the link with a browser it never loads. Any chance I could get an updated link for this? I really need it for my work.

Thanks!

I just tried downloading it from a remote location, and it worked fine. Can you try again? Are you behind some sort of firewall that would block a Dropbox link?

Yup, works. :) Thanks very much. I had tried downloading it behind a firewall, which caused that hanging.