Tomassino
Tomassino

Reputation: 305

Matplotlib ft2font build error (python3)

Experiencing the following error when trying to build matplotlib for Python3. I have installed Numpy and Scipy already (including debug extensions). I have also installed libpng12-0 and libfreetype6 (and debug) but still nothing.

After running python3 setup.py build I get the following:

running build_ext
building 'matplotlib.ft2font' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/usr/include -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/include/python3.2mu -c src/ft2font.cpp -o build/temp.linux-i686-3.2/src/ft2font.o
In file included from ./CXX/Extensions.hxx:37:0,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

tom@dev-Optiplex:~/Downloads/matplotlib$ sudo find / -name "ft2font*"
/home/tom/Downloads/matplotlib/src/ft2font.cpp
/home/tom/Downloads/matplotlib/src/ft2font.h
tom@dev-Optiplex:~/Downloads/matplotlib$ 

I can't seem to make much sense of it, as it seems to fail finding the src/ft2font.* files but when I search for them, they are definitely present. What am I missing?

Thanks!

Upvotes: 1

Views: 1460

Answers (1)

tacaswell
tacaswell

Reputation: 87526

It looks like you are missing Python.h. Do you have the python3-dev package installed?

The indication is that the file that is not found is Python.h.

In file included from ./CXX/Extensions.hxx:37:0,<-- (2) an include file in (1)
                 from src/ft2font.h:6,    <-- (1) an include file in (0)
                 from src/ft2font.cpp:3:  <-- (0) file gcc was trying to compile
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
  ^ (3) an include in (2) with error      ^ the actually missing file

Python.h is the dev header for python. If you do not know what package a missing header belongs to, you can check the packaging for you distro, most of them have a 'search by filename' functionality. Ex the ubuntu package listing.

Upvotes: 1

Related Questions