Reputation:
I am trying to install matplotlib
using:
pip install matplotlib
However, I keep getting this error:
- cannot open include file 'ft2build.h' no such file or directory
Upvotes: -1
Views: 2638
Reputation: 20599
You are using python 3.8 for which no pre-built whl
files are avialable on pypi
, therefore your pip
is attempting to build matplotlib from source. For this, you need to have downloaded and installed the dependencies of matplotlib
. In this case, ft2build.h
is missing which is part of the freetype
library.
If you really want to build from source, there is a script based solution from the matplotlib developers to download and install all neccessary dependencies.
Since you probably don't care about building from source (which can be quite some work on Windows), you should instead consider one of these options:
whl
file for modules you want to usematplotlib‑3.2.0rc1‑cp38‑cp38‑win_amd64.whl
from this unofficial collection of whl files and do pip install matplotlib‑3.2.0rc1‑cp38‑cp38‑win_amd64.whl
in your cmdUpvotes: 1
Reputation: 1974
It is a bit unclear what your problem is. It may just be that you have some packages that are not compatible. To avoid this sort of issue I can recommend the use of Anaconda: https://www.anaconda.com/
It will come with python and most basic libraries, including matplotlib. I can also recommend seaborn for professional-looking plots that do not require much code.
Upvotes: -2