ft2build.h is located here:
C:\\Program Files\\GnuWin32\\include
Initially, I made the same mistake as here:
Fatal
I was able to solve this on Windows by doing the following:
set INCLUDE=%INCLUDE%;C:\tmp\msvcr90-x32
set LIB=%LIB%;C:\tmp\msvcr90-x32
pip.exe install matplotlib
The link libraries for Freetype on windows can be found here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib (from meawoppl's comment)
Just download the "matplotlib‑1.x‑windows‑link‑libraries.zip", and open the README from the zip.
Have you installed freetype properly? If you have, there should be a file named ft2build.h
somewhere under the installation directory, and the directory where that file is found is the one that you should specify with -I
. The string "GnuWin32" does not appear anywhere in the output of your build command, so it looks like you have not placed that directory in the correct include list.
This question comes up high in Google for this error, so like several others I'll ignore the fact that it's asking about Windows only.
On Debian 10 (Buster) I had to do:
sudo apt install libfreetype6-dev pkg-config
Note the pkg-config
dependency; without it, the FreeType headers get installed, but matplotlib is unable to find them. It warns about this before spitting out pages of output, so it's easy to miss:
IMPORTANT WARNING:
pkg-config is not installed.
matplotlib may not be able to find some of its dependencies
I had the same error in red hat 6. Turns out that I needed to install freetype-devel
, not freetype
(using sudo yum install freetype-devel
)
I spent hours trying to get matplotlib to install with the latest python 3, pip, setuptools everything... What finally worked for me was going to https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib downloading the wheel file and executing this in the same directory:
pip install matplotlib‑3.2.0rc2‑cp38‑cp38‑win_amd64.whl