Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`Sudo pip install matplotlib` fails to find freetype headers. [OS X Mavericks / 10.9] [closed]

I already have matplotlib-1.2.1 installed as well as numpy-1.8.0. Note - I am using system python with homebrew installed - I have $PYTHONPATH set so Python loads from /Library/Python/x.y/site-packages (where pip installs to).

Here is the code for installing matplotlib (the configurations)

BUILDING MATPLOTLIB             matplotlib: yes [1.3.1]                 python: yes [2.7.5 (default, Aug 25 2013, 00:04:04)  [GCC                         4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]]               platform: yes [darwin]  REQUIRED DEPENDENCIES AND EXTENSIONS                  numpy: yes [version 1.8.0]               dateutil: yes [using dateutil version 1.5]                tornado: yes [tornado was not found. It is required for the                         WebAgg backend. pip/easy_install may attempt to                         install it after matplotlib.]              pyparsing: yes [pyparsing was not found. It is required for                         mathtext support. pip/easy_install may attempt to                         install it after matplotlib.]                  pycxx: yes [Couldn't import.  Using local copy.]                 libagg: yes [pkg-config information for 'libagg' could not                         be found. Using local copy.]               freetype: yes [version 17.1.11]                    png: yes [version 1.5.17]  OPTIONAL SUBPACKAGES            sample_data: yes [installing]               toolkits: yes [installing]                  tests: yes [nose 0.11.1 or later is required to run the                         matplotlib test suite]  OPTIONAL BACKEND EXTENSIONS                 macosx: yes [installing, darwin]                 qt4agg: no  [PyQt4 not found]                gtk3agg: no  [Requires pygobject to be installed.]              gtk3cairo: no  [Requires cairo to be installed.]                 gtkagg: no  [Requires pygtk]                  tkagg: yes [installing, version 81008]                  wxagg: no  [requires wxPython]                    gtk: no  [Requires pygtk]                    agg: yes [installing]                  cairo: no  [cairo not found]              windowing: no  [Microsoft Windows only]  OPTIONAL LATEX DEPENDENCIES                 dvipng: yes [version 1.14]            ghostscript: yes [version 9.02]                  latex: yes [version 3.1415926]                pdftops: no 

And then later down the line, after copying and building files, it gets to build_ext and fails because of missing header files.

running build_ext building 'matplotlib.ft2font' extension creating build/temp.macosx-10.9-intel-2.7 creating build/temp.macosx-10.9-intel-2.7/src creating build/temp.macosx-10.9-intel-2.7/CXX cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.9-intel-2.7/src/ft2font.o  clang: warning: argument unused during compilation: '-mno-fused-madd' In file included from src/ft2font.cpp:3: In file included from src/ft2font.h:6: In file included from ./CXX/Extensions.hxx:40: In file included from ./CXX/Python2/Extensions.hxx:52: ./CXX/Python2/Objects.hxx:1133:23: warning: implicit conversion of NULL constant to 'int' [-Wnull-conversion]             , offset( NULL )                     ~ ^~~~                       0  In file included from src/ft2font.cpp:3: In file included from src/ft2font.h:16: /usr/X11/include/ft2build.h:56:10: fatal error: 'freetype/config/ftheader.h' file not found #include <freetype/config/ftheader.h>          ^ 1 warning and 1 error generated.  error: command 'cc' failed with exit status 1 ----------------------------------------    Rolling back uninstall of matplotlib   Replacing /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib-1.1.1-py2.7.egg-info Cleaning up...   Removing temporary dir /private/tmp/pip_build_root... Command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip_build_root/matplotlib/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vHUPhA-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/tmp/pip_build_root/matplotlib Exception information: Traceback (most recent call last):   File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/basecommand.py", line 134, in main     status = self.run(options, args)   File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/commands/install.py", line 241, in run     requirement_set.install(install_options, global_options, root=options.root_path)   File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 1298, in install     requirement.install(install_options, global_options, *args, **kwargs)   File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 625, in install     cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)   File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/util.py", line 670, in call_subprocess     % (command_desc, proc.returncode, cwd)) InstallationError: Command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip_build_root/matplotlib/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vHUPhA-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/tmp/pip_build_root/matplotlib 
like image 843
kratsg Avatar asked Dec 13 '13 17:12

kratsg


1 Answers

I had the same problem, and finally found the solution by checking the compilation commands. It's really simple:

ln -s /usr/local/opt/freetype/include/freetype2 /usr/local/include/freetype 
like image 80
Luis M Rodriguez-R Avatar answered Oct 01 '22 03:10

Luis M Rodriguez-R