I want to install matplotlib via pip. There is a problem with freetype2.h


             numpy: 1.6.2

         freetype2: found, but unknown version (no pkg-config)

                    * WARNING: Could not find 'freetype2' headers in any

                    * of '.', './freetype2'.

Somebody had a similar problem ( How to install matplotlib on OS X?), and it was suggested to install pkg-config first. I did that with macports, but I still get the same warning.

I used find to look for the headers, and they are definitely present in:


How can I use those files to install matplotlib?


Matplotlib require freetype. And you lost freetype c lib.
on Linux/Ubuntu, install freetype2 lib first

sudo apt-get install libfreetype6
  • Downvote because this is not sufficient. Pip installing matplotlib also requires at least libfreetype6-dev. – Jonathan Hartley Jul 24 '14 at 21:01

I think you ought to be able to install the freetype headers (and also the Python ones, which will be needed too) in the expected place using:

sudo apt-get install libfreetype6-dev python-dev

But, for reasons I don't understand, after this, I still got a 'missing python.h' error when pip installing matplotlib. It didn't work for me until I had done:

sudo apt-get build-dep python-matplotlib

which installed & compiled craploads of junk (presumably for optional features of matplotlib?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.