I've been trying to install pycairo on a mac os x. I'm getting an error message,
Initially I was getting 'pkg-config' not found
. After installing that through brew, I get Package cairo was not found in the pkg-config search path
. In principle I could try to edit the search path, but since this is going through pip, I would have expected this to be all taken care of. Is there a way to tell pip to put the stuff where pkg-config knows to look?
Here's the full message.
> pip install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Building wheels for collected packages: pycairo
Building wheel for pycairo (setup.py) ... error
ERROR: Complete output from command /Applications/anaconda/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/f2/bzrj46j11gzdk19j91tp1sq80000gq/T/pip-install-lahb8lq4/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 /private/var/folders/f2/bzrj46j11gzdk19j91tp1sq80000gq/T/pip-wheel-scnvplas --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.6
creating build/lib.macosx-10.7-x86_64-3.6/cairo
copying cairo/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.7-x86_64-3.6/cairo
copying cairo/py.typed -> build/lib.macosx-10.7-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
I get the same error if I use pip to install an older version.
There is a similar question here: How can I fix the problem when installing pycairo on windows?, but it's related to Windows, and the error looks to be different to me (also I'm not satisfied by the answer).
Any suggestion for how to fix this?
brew install pkg-config
to install pkg-config package? – Lookseebrew
on my machine. I've always used pip to install python packages. Haven't encountered pkg-config, so I assumed it was some form of config file coming with pycairo... Google now tells me it's more than that... – GrumblePackage cairo was not found in the pkg-config search path.
I'm editing the question to include this. Do you have a suggestion for how I can fix this to work within pip? – Grumblepycairo
are just Python bindings tocairo
package. Install it first via Homebrew:brew install cairo
– Ledapip
has to compile it and for compilation it needs a lot of dependencies: a compiler, libraries, development files for the libraries (header/include files,pkg-config
configuration). – Artlesscairo
package throughbrew
then try yourpip install pycairo
. I think it could help you. – Linotype