I am attempting to run some matplotlib tutorials on my Pi3 running Raspbian Stretch.
I have installed matplotlib
& numpy
using pip3
When trying to run any of the tutorials I get an error ImportError: No module named 'cairocffi'
and ImportError: Cairo backend requires that cairocffi or pycairo is installed.
I attempted to install cairocffi
Collecting cairocffi
Using cached https://www.piwheels.hostedpi.com/simple/cairocffi/cairocffi-0.8.0-py3-none-any.whl
Collecting cffi>=1.1.0 (from cairocffi)
Using cached cffi-1.11.2.tar.gz
Collecting pycparser (from cffi>=1.1.0->cairocffi)
Using cached https://www.piwheels.hostedpi.com/simple/pycparser/pycparser-2.18-py2.py3-none-any.whl
Building wheels for collected packages: cffi
Running setup.py bdist_wheel for cffi: started
Running setup.py bdist_wheel for cffi: finished with status 'error'
–
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
–
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.5
creating build/lib.linux-armv7l-3.5/cffi
–
building '_cffi_backend' extension
creating build/temp.linux-armv7l-3.5
creating build/temp.linux-armv7l-3.5/c
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/c/_cffi_backend.o
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: pycparser, cffi, cairocffi
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3l0i4pgl/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hlec49cb-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
The tutorials apparently run successfully on Windows and other machines, so I am assuming the problem is a Pi specific issue, and not just a python
problem.
Can anyone point me in the right direction. I note /usr/lib/arm-linux-gnueabihf/libffi.so.6
is on the Pi.