pip install fails for pycairo CentOS 7
pip fails with the following on CentOS 7
Collecting pycairo
Downloading https://files.pythonhosted.org/packages/e8/9d/c8be300fc6b1298559d37a071c3833b0b251e0fff334d2e4c408d5789162/pycairo-1.19.1.tar.gz (205kB)
|████████████████████████████████| 215kB 6.1MB/s
Building wheels for collected packages: pycairo
Building wheel for pycairo (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/pete312/.one/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-43ecp5lz/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-43ecp5lz/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-7hpuy85u --python-tag cp36
cwd: /tmp/pip-install-43ecp5lz/pycairo/
Complete output (15 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pycairo
Running setup.py clean for pycairo
Failed to build pycairo
Is there a workaround for that ?
Assuming centos is similar to fedora here, see https://pycairo.readthedocs.io/en/latest/getting_started.html
OK that did install but i would caution about installing python3-devel as that may install python3 into system level dirs which may or may not be OK for prod. We should be using pip wheels avoid harm.
Is pycairo considered prod ? edit for CentOS 7 its : sudo yum install cairo-devel pkg-config
@pete312 you need python3-devel for python C headers that allow you to compile things.
Cairo itself is a system library, hence cairo-devel, once you have those you can install pycairo anywhere (e.g. in your virtualenv).
pycairo doesn't currently have manylinux whls, if it did then you would not longer need the compilation step.
I don't think there anything left to do here, so I'm closing this.