Unable to install graphite due to pycairo dependecy and compatibility with Python 2.7.3

Asked by Jonathan Kvam

Good day,

I'm excited in trying out graphite for our NOC monitoring solution. We are currently using CentOS 5.7 x86_64. While configuring the graphite webapp I ran:

python check-dependencies.py

and got:

[FATAL] Unable to import the 'cairo' module, do you have pycairo installed for python 2.7.3?
[FATAL] Unable to import the 'tagging' module, do you have django-tagging installed for python 2.7.3?

I attempted to do an easy_install pycairo, but it bombed out:

[root@MMBWKVAMJ ~]# easy_install pycairo
Searching for pycairo
Reading http://pypi.python.org/simple/pycairo/
Reading http://cairographics.org/pycairo
Best match: pycairo 1.10.0
Downloading http://cairographics.org/releases/pycairo-1.10.0.tar.bz2
Processing pycairo-1.10.0.tar.bz2
error: Couldn't find a setup script in /tmp/easy_install-2pYOr8/pycairo-1.10.0.tar.bz2

However it did give me the url for the package so I did a wget http://cairographics.org/releases/pycairo-1.10.0.tar.bz2

One of the first steps on installing cairo from its INSTALL file is to do a ./waf configure, however, I get got this when running it:

[root@MMBWKVAMJ pycairo-1.10.0]# ./waf configure
  ./options()
Setting top to : /home/kvamj/Downloads/pycairo-1.10.0
Setting out to : /home/kvamj/Downloads/pycairo-1.10.0/build_directory
  ./configure()
Checking for 'gcc' (c compiler) : ok
Checking for program python : /usr/local/bin/python
Checking for python version : (2, 7, 3, 'final', 0)
The python version is too old, expecting (3, 1, 0)
(complete log in /home/kvamj/Downloads/pycairo-1.10.0/build_directory/config.log)

Do you know which version of pycairo I can use with Python 2.7.3, and also, you don't happen to have an install package with dependencies and such?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Graphite Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Michael Leinartas (mleinartas) said :
#1

On CentOS 5 I've had the best luck using the shipped python2.4 (Graphite is still 2.4 compatible) and installing dependencies from the upstream repos and EPEL (http://fedoraproject.org/wiki/EPEL). The CentOS base repo has a version of pycairo that works with graphite.

If you still want to continue with python2.7 and pip, it looks like pycairo split their python2 support into the py2cairo package..however, pip doesn't have a py2cairo package available. Instead, try using the version just before the split: 1.8.8 (or an older one):
pip install pycairo==1.8.8

Revision history for this message
Steve Keller (skeller-ea) said :
#2

Having just gone through this with RHEL 5.8 and Python 2.7.3, I can say this - you have to install a pycairo version that is the same as the version of the cairo library you have. For us, with our repos, that was 1.2.4 (cairo) and 1.20 pycairo.

Also, you have to build pycairo, there is no other way to install it on RHEL 5 using a newer Python. To do this, you have to configure in the following way, after downloading and untarring the source:

PYTHON=/usr/bin/python2.7 ./configure

If you don't do that, python gets installed in the default Python, 2.4.

Hope this helps.

Note - this was a major pain for me (maybe I'm just dumb), but the install instructions for pycairo do not include this information, and there are a couple of places that Google found that have the sequence of commands wrong.

Revision history for this message
Artscoop93 (artscoop93) said :
#3

You must use py2cairo if python 2.x is installed.
http://cairographics.org/pycairo/

Revision history for this message
Mike (tewner) said :
#4

skeller-ea 's comment was really helpful.

I downloaded and tried installing pycairo-1.2.0.tar.gz . By me, though, CentOS was putting the libraries in /usr/local , and Python wasn't finding it there:

Python 2.6.8 (unknown, Apr 12 2012, 20:59:36)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycairo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pycairo

Instead of changing the system-wide configuration (and possibly breaking things), I changed the prefix in the build:

PYTHON=/usr/bin/python2.6 ./configure --prefix /usr

then make && make install

and now python2.6 finds cairo:

Python 2.6.8 (unknown, Apr 12 2012, 20:59:36)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>>

Can you help with this problem?

Provide an answer of your own, or ask Jonathan Kvam for more information if necessary.

To post a message you must log in.