Güngör Budak's Blog

Bioinformatics, web programming, coding in general

Install Cairo Graphics and PyCairo on Ubuntu 14.04 / Linux Mint 17

Cairo is a 2D graphics library implemented as a library written in the C programming language but if you’d like to use Python programming language, you should also install Python bindings for Cairo.

Cairo Logo

This guide will go through installation of Cairo Graphics library version 1.14.2 (most recent) and py2cairo Python bindings version 1.10.1 (also most recent).

Install Cairo

It’s very easy with the following repository. Just add it, update your packages and install.

sudo add-apt-repository ppa:ricotz/testing
sudo apt-get update
sudo apt-get install libcairo2-dev

Install py2cairo

cd ~
git clone git://git.cairographics.org/git/py2cairo

See what’s your prefix

python -c "import sys; print sys.prefix"

Install dependencies

sudo apt-get install automake pkg-config libtool


cd ~/py2cairo
./autogen.sh --prefix=/usr
sudo make
sudo make install


>>> import cairo
>>> cairo.cairo_version_string()
>>> cairo.version

Now, you can use up-to-date versions of these softwares in your computer.