Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors installing Matplotlib - clang

I've tried to install Matplot lib but I'm still struggling to get past errors.

I've installed numpy and psipy but have the following error when I use easy_install (there is a similar error with pip).

And yes, I've installed the command line tools in Xcode in a bid to solve the 'gcc-4.2 not found' problem.

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor',          

'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units',     

'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid',     

'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext',    

'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
warning: no files found matching 'KNOWN_BUGS'
warning: no files found matching 'INTERACTIVE'
warning: no files found matching 'MANIFEST'
warning: no files found matching '__init__.py'
warning: no files found matching 'examples/data/*'
warning: no files found matching 'lib/mpl_toolkits'
warning: no files found matching 'LICENSE*' under directory 'license'
gcc-4.2 not found, using clang instead
In file included from src/ft2font.cpp:3:
src/ft2font.h:16:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
     ^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
like image 625
elksie5000 Avatar asked Oct 16 '12 08:10

elksie5000


3 Answers

I recently had this issue as well, but I was using pip. If you have homebrew installed you can solve it by running the following commands:

brew install freetype
brew install libpng
brew link freetype
pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev
like image 51
BigHandsome Avatar answered Oct 05 '22 08:10

BigHandsome


theres actually an easier way! First see if X11 libraries are installed (ls /usr/X11/include)

If they aren't you may need to install X11

If they are then a simple fix is this:

cd /usr/X11/include
sudo ln -s freetype2/freetype

Basically for some reason its looking for the freetype library at /usr/X11 and its actually in the subfolder in freetype2. Odd - but it does then compile this way.

like image 44
willwade Avatar answered Oct 05 '22 10:10

willwade


I did the following and it worked for me

sudo apt install libfreetype6-dev
pip install matplotlib
like image 39
m33n Avatar answered Oct 05 '22 10:10

m33n