Hello, I'm a science YouTuber in Japan with subscribers 10000+.
I'm such a big fan of 3Blue1Brown's video that I started to upload mathematical videos. These days, 3b1b's video makes me want to make mathematical animations like him.
Today, I tried to install manim to my Mac OS Mojave (ver 10.14.4), following Brian Howell's website (http://bhowell4.com/manic-install-tutorial-for-mac/). But I have a trouble in installing pycairo.
... - ... -MacBook-Pro:manim kasagonaoki$ pip install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/94/qz1q_1015gq84sdfwns2f8hm0000gn/T/pip-install-s_02k2sk/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/94/qz1q_1015gq84sdfwns2f8hm0000gn/T/pip-record-jskbs96p/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.9-x86_64-3.7/cairo
running build_ext
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
Package 'libffi', required by 'gobject-2.0', not found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/94/qz1q_1015gq84sdfwns2f8hm0000gn/T/pip-install-s_02k2sk/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/94/qz1q_1015gq84sdfwns2f8hm0000gn/T/pip-record-jskbs96p/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/94/qz1q_1015gq84sdfwns2f8hm0000gn/T/pip-install-s_02k2sk/pycairo/
How do I attack this problem ?
Same error here.
This solved my problem:
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/libffi/lib"
Thank you ! Your suggestion solved the problem !
Here is what I did, I'm not familiar to Linux, the problem is still there, how to do next? thank you so much @mrichman
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
โ ~ export LDFLAGS="-L/usr/local/opt/libffi/lib"
โ ~ pip3 install pycairo
Looking in indexes: https://pypi.python.org/simple, https://pypi.apple.com/simple
Collecting pycairo
Downloading https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz (200kB)
|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 204kB 202kB/s
Building wheels for collected packages: pycairo
Building wheel for pycairo (setup.py) ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-install-vc8gwgfl/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/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-wheel-xf8zf67r --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.9-x86_64-3.7/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
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-install-vc8gwgfl/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-record-9vmu83gb/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.9-x86_64-3.7/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: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-install-vc8gwgfl/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-record-9vmu83gb/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/d3/lf6l3m_j6cq3vt06_jqbxjw00000gn/T/pip-install-vc8gwgfl/pycairo/
@BraverChiang You need to install the cairo library https://stackoverflow.com/questions/1500866/how-to-install-pycairo-on-osx
brew install cairo and rerun pip install
Most helpful comment
This solved my problem: