Trying to install pycairo I get a missing C lib cairo.h
. I already have installed libcairo2-dev
and updated pip3
. Any ideas on how to fix?
pip install pycairo
Collecting pycairo
Using cached pycairo-1.21.0.tar.gz (340 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: pycairo
Building wheel for pycairo (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /home/dbarcene/anaconda3/bin/python /home/dbarcene/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp_4nbw_f7
cwd: /tmp/pip-install-3i43xt78/pycairo_0149ed3d8f314887ad96f80dbc14140d
Complete output (21 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-cpython-38/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-cpython-38/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-cpython-38/cairo
running build_ext
building 'cairo._cairo' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/cairo
/home/dbarcene/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/dbarcene/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/dbarcene/anaconda3/include -fPIC -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=21 -DPYCAIRO_VERSION_MICRO=0 -I/usr/lib/include/cairo -I/usr/lib/include -I/usr/lib/include/glib-2.0 -I/usr/lib/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/include -I/usr/lib/include/pixman-1 -I/usr/lib/include -I/usr/lib/include/uuid -I/usr/lib/include -I/usr/lib/include/freetype2 -I/usr/lib/include/libpng16 -I/usr/lib/include -I/home/dbarcene/anaconda3/include/python3.8 -c cairo/bufferproxy.c -o build/temp.linux-x86_64-cpython-38/cairo/bufferproxy.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
In file included from cairo/private.h:42:0,
from cairo/bufferproxy.c:34:
cairo/pycairo.h:37:10: fatal error: cairo.h: No such file or directory
#include <cairo.h>
^~~~~~~~~
compilation terminated.
error: command '/home/dbarcene/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for pycairo
As I am using anaconda I tried installing through conda with the command:
conda install -c conda-forge/label/gcc7 pycairo
It checked for several inconsistencies in my base env, but at the end it installed using a "Package Plan" with this contents:
## Package Plan ##
environment location: /home/dbarcene/anaconda3
added / updated specs:
- pycairo
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2018.10.15 | ha4d7672_0 135 KB conda-forge/label/gcc7
pybind11-2.4.3 | py38hfd86e86_0 134 KB
pycairo-1.21.0 | py38h287db57_0 120 KB
------------------------------------------------------------
Total: 389 KB
The following NEW packages will be INSTALLED:
jinja2 pkgs/main/noarch::jinja2-2.11.3-pyhd3eb1b0_0
pybind11 pkgs/main/linux-64::pybind11-2.4.3-py38hfd86e86_0
pycairo pkgs/main/linux-64::pycairo-1.21.0-py38h287db57_0
pycodestyle pkgs/main/noarch::pycodestyle-2.6.0-pyhd3eb1b0_0
pyflakes pkgs/main/noarch::pyflakes-2.2.0-pyhd3eb1b0_0
The following packages will be SUPERSEDED by a higher-priority channel:
ca-certificates pkgs/main::ca-certificates-2022.4.26-~ --> conda-forge/label/gcc7::ca-certificates-2018.10.15-ha4d7672_0
I also checked in a console import cairo
and it seems to work. There are certainly some dependencies broken that I haven't figured out yet, but this might serve as a workaround for now.