WebFaction
Community site: login faq

Hi you all, I'm trying to install Pango and Cairo for using them from Python. I managed to install Cairo but couldn't do it with Pango. I followed a couple of howtos I found but didn't work out. Any help will be appreciated. I'm kindof a newbie with this, so I hope you'll be patient : ) Thanks in advance

asked 21 Nov '12, 22:12

joanca
1112
accept rate: 0%

edited 21 Nov '12, 22:16

Many thanks ryans, Everything worked since i got to install pygobject 2.28.6 Then I got this error, I don't know how to proceed properly (remember, newbie : )

-------------------------------------------
...
checking for GLIB - version >= 2.24.0... 
*** 'pkg-config --modversion glib-2.0' returned 2.31.22, but GLIB (2.33.10)
*** was found! If pkg-config was correct, then it is best
*** to remove the old version of GLib. You may also be able to fix the error
*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
*** /etc/ld.so.conf. Make sure you have run ldconfig if that is
*** required on your system.
*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH
*** to point to the correct configuration files
no
configure: error: maybe you want the pygobject-2-4 branch?
-------------------------------------------

Thanks again for your help

(23 Nov '12, 11:26) joanca

I have just installed in a test account with no problem. Please open a ticket at our support site, and we'll help you find the exact cause of the issue.

(23 Nov '12, 15:19) timg ♦♦

The answer will have two parts.

First is the installation of Cairo (and its dependencies) and Pango (with its dependencies). When both of those are installed in the right order, pangocairo will be compiled automatically by virtue of Pango finding Cairo during its configuration phase (it's libpangocairo-1.0.so).

Second is the installation of pygtk, which is the python binding which allows python to interact with these packages and includes the pangocairo binding. It requires pygobject and pycairo.

I had to install Cairo, Pango, and pygobject as part of this massive Xfce install guide. Here are the install commands for just this set of packages (and their dependencies) using the same mirrored files where possible, for convenience:

mkdir -p $HOME/src $HOME/tmp
ln -s $HOME/lib $HOME/lib64
export TMPDIR="$HOME/tmp"
export PATH="$HOME/bin:$PATH"
export C_INCLUDE_PATH="$HOME/include:$C_INCLUDE_PATH"
export LIBRARY_PATH="$HOME/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I$HOME/include $CPPFLAGS"
export LDFLAGS="-L$HOME/lib $LDFLAGS"
export PKG_CONFIG_PATH="$HOME/lib/pkgconfig"

export PYTHON=python2.7
mkdir -p $HOME/lib/${PYTHON}

# =========================================
# pixman 0.24.4
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/pixman-0.24.4.tar.gz'
tar -xzf pixman-0.24.4.tar.gz
cd pixman-0.24.4
./configure --prefix=$HOME
make
make install

# =========================================
# cairo 1.12.0
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/cairo-1.12.0.tar.gz'
tar -xzf cairo-1.12.0.tar.gz
cd cairo-1.12.0
./configure --prefix=$HOME
make    # 2m
make install

# =========================================
# libffi 3.0.11
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/libffi-3.0.11.tar.gz'
tar -xzf libffi-3.0.11.tar.gz
cd libffi-3.0.11
./configure --prefix=$HOME
make
make install

# =========================================
# Glib 2.31.22
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/glib-2.31.22.tar.xz'
tar -xJf glib-2.31.22.tar.xz
cd glib-2.31.22
PYTHON=${PYTHON} ./configure --prefix=$HOME
make    # 2.5m
make install

# =========================================
# pango 1.30.0
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/pango-1.30.0.tar.xz'
tar -xJf pango-1.30.0.tar.xz
cd pango-1.30.0
./configure --prefix=$HOME --sysconfdir=$HOME/etc
make    # 22s
make install

# =========================================
# pygobject 2.28.6
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/pygobject-2.28.6.tar.bz2'
tar -xjf pygobject-2.28.6.tar.bz2
cd pygobject-2.28.6
PYTHON=${PYTHON} ./configure --prefix=$HOME --disable-introspection
make
make install

# =========================================
# py2cairo 1.10.0
# =========================================
cd $HOME/src
wget 'http://www.cairographics.org/releases/py2cairo-1.10.0.tar.bz2'
tar -xjf py2cairo-1.10.0.tar.bz2
cd py2cairo-1.10.0
$PYTHON ./waf configure --prefix=$HOME
$PYTHON ./waf build
$PYTHON ./waf install

# =========================================
# pygtk 2.24.0
# =========================================
cd $HOME/src
wget 'http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.24/pygtk-2.24.0.tar.bz2'
tar -xjf pygtk-2.24.0.tar.bz2
cd pygtk-2.24.0
./configure --prefix=$HOME
make    # 22s
make install

Then, just run $PYTHON and you can import all of the following modules:

Python 2.7.3 (default, May 18 2012, 14:51:16) 
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>> import pango
>>> import pangocairo
>>> import glib
>>> import gobject
>>> import pygtk
>>>

Hope that helps!

permanent link
This answer is marked "community wiki".

answered 22 Nov '12, 00:56

ryans ♦♦
5.0k93260
accept rate: 43%

edited 27 Sep '16, 02:01

I tried to install this using latest packages according to http://www.linuxfromscratch.org, aiming to get Weasyprint to work http://weasyprint.readthedocs.io/en/latest/install.html

But i get this error when trying to configure Glib:

checking libmount/libmount.h usability... no
checking libmount/libmount.h presence... no
checking for libmount/libmount.h... no
configure: error: *** Could not find libmount

I did find this post. The symlink is in place. But there is no libmount.h I do not know what package I need to install it.

Also I've tried to change the refence to python to 3.5, as Weasyprint strongly suggests using python 3. But neither 3.5 nor 2.7 work, both giving the same error.

Hope you can point me in the right direction

(13 Jun '17, 12:41) Etienne
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×3
×2

question asked: 21 Nov '12, 22:12

question was seen: 17,095 times

last updated: 13 Jun '17, 12:42

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM