Search code examples
pythonmacosmatplotlibmacportsfreetype

Unable to install matplotlib on Mac OS X


I'm trying to install matplotlib for graphing applications in Python on Mac OS X. When I run "python setup.py install", it gives me this load of errors: http://pastebin.com/u7fL37ic.

A quick snippet:

src/ft2font.cpp:2170: error: ‘FT_LOAD_TARGET_MONO’ was not declared in this scope
src/ft2font.cpp:2171: error: ‘FT_LOAD_TARGET_LCD’ was not declared in this scope
src/ft2font.cpp:2172: error: ‘FT_LOAD_TARGET_LCD_V’ was not declared in this scope
src/ft2font.cpp:2175: error: ‘_ft2Library’ was not declared in this scope
src/ft2font.cpp:2175: error: ‘FT_Init_FreeType’ was not declared in this scope
src/ft2font.cpp: In destructor ‘virtual ft2font_module::~ft2font_module()’:
src/ft2font.cpp:2186: error: ‘_ft2Library’ was not declared in this scope
src/ft2font.cpp:2186: error: ‘FT_Done_FreeType’ was not declared in this scope
lipo: can't figure out the architecture type of: /var/folders/Nj/Njnlp9qSF64sMESWcaDnk++++TI/-Tmp-//cchyYmM5.out
error: command 'gcc-4.0' failed with exit status 1

I installed freetype using MacPorts, and I thought that would fix the issue, but no luck. Gives me same error as before. It looks like it can't find the right freetype files:

BUILDING MATPLOTLIB
        matplotlib: 1.0.0
            python: 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)  [GCC
                    4.0.1 (Apple Inc. build 5493)]
          platform: darwin
REQUIRED DEPENDENCIES
             numpy: 1.5.0
         freetype2: found, but unknown version (no pkg-config)
                    * WARNING: Could not find 'freetype2' headers in any
                    * of '.', './freetype2'.

Where should I put the freetype files so that they can be found? Right now they're in /opt/local/lib

Any ideas?


Solution

  • you may also consider using the Enthought distribution (which comes even free for non-commercial usage) It comes fully installed without any difficulty http://www.enthought.com/products/getepd.php (I have no relationship with Enthought whatsoever - I'm just a satisfied user)