So I have venv that I want to use the pycairo module that is not yet installed
(venv) command$ python -m pip install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/3c/1a/c0478ecab31baae50fda9956547788afbd0ca563adc52c9b03cab30f17eb/pycairo-1.18.2.tar.gz
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
Complete output from command /home/user/Code/manim/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-gtt_9z57/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 /tmp/pip-record-9arnuyr8/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/Code/manim/venv/include/site/python3.7/pycairo:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.linux-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.
----------------------------------------
Command "/home/user/Code/manim/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-gtt_9z57/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 /tmp/pip-record-9arnuyr8/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/Code/manim/venv/include/site/python3.7/pycairo" failed with error code 1 in /tmp/pip-install-gtt_9z57/pycairo/
Any suggestions? I'm on Ubuntu 19.10 if that makes a difference
I found the solution!
I needed to run
sudo apt install libcairo2-dev
and
sudo apt install python3-dev
Happy day.