1

Does anyone have any experience with trying to install cairo for django using buildout? It will install pycairo or py2cairo (the first is for python >3.0, the latest is for python 2.6, which I Am using)

I found 2 recipes to use for installation, both of them gives me errors, in buildout.cfg I have them as 2 parts (of course tried them seperately, not thogether). The errors are totally different, but the result is the same: I can't get cairo installed using buildout.......

based on: http://pypi.python.org/pypi/tl.buildout_gtk/

[cairo_tl]
recipe = tl.buildout_gtk
#pycairo-url = http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2
pycairo-url =   http://cairographics.org/releases/py2cairo-1.8.10.tar.gz
pycairo-md5sum = http://cairographics.org/releases/py2cairo-1.8.10.tar.gz.md5

based on: https://bitbucket.org/lgs/yaco.recipe.pycairo

[cairo_yaco]  
recipe = yaco.recipe.pycairo  
find-links = http://pypi.python.org/pypi/yaco.recipe.pycairo/0.1.1  
#find-links = http://pypi.python.org/pypi/yaco.recipe.pycairo/0.1  
# pkg-config-path ?

Both need a local install of cairo (pycairo and py2cairo depend on this): so use on the server:

sudo apt-get install libcairo2-dev

The part jusing tl.buildout_gtk:

Either using the py2cairo-1.10.0 or pycairo-1.8.2 gives me a MD5 checksum mismatch (see for available releases: http://cairographics.org/releases/) e.g:

Error: MD5 checksum mismatch downloading 'http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2'

or:

Error: MD5 checksum mismatch downloading 'http://cairographics.org/releases/py2cairo-1.8.10.tar.gz'

The part jusing yaco:

I Am pretty sure this part is not configured correctly (pkg-config-path refering to the local cairo package), but I do not even get to that point. It gives an error:

DistributionNotFound: zc.recipe.cmmi

However, this is installed in the eggs

By the way, I had the same kind of headache trying to install PIL by buildout, which I solved combining a lot of options and posts on the internet, together with a lot of time and trials and errors. If anyone want to know how I finally got it working, just ask, and I will publish it. (I consider myselve still a django starter, so I do not know for sure if anyone is interested in the solution)

PIL does not have all the options I found in cairo, so I started using cairo. On my local PC everything works fine (ubuntu desktop), on my server (Ubuntu server) I can't getting it to work...... Any other options for making drawings on the fly..... (like matplotlib...) let me know.

michel.iamit
  • 5,788
  • 9
  • 55
  • 74
  • 1
    The PIL installation part of your question is answered [here on SO](http://stackoverflow.com/questions/2485295/the-problem-with-installing-pil-using-virtualenv-or-buildout/2486396#2486396). :-) – Martijn Pieters Sep 11 '11 at 09:23

2 Answers2

2

Pretty sure you have to give the real md5 hash to the pycairo-md5 option instead of a string with some url in it.

Reinout van Rees
  • 13,486
  • 2
  • 36
  • 68
  • Ok, following the ling to the md5 checksum, and filling this in, got me a bit further. No error in the checksum anymore. The next error is a missing package. Before voting for anyting, the other option below also seems to make sense, so i wanna try that as well. Figuring this all out already took me a long time, so in stead of using the buildout, i already installed everything completely on the server outside buildout..... – michel.iamit Sep 10 '11 at 13:14
  • 2
    Often the best option for such packages with elaborate dependencies is to install it using your OS's mechanism. I always install mapnik with ubuntu's aptitude, for instance, instead of mucking around with compiling stuff from buildout. – Reinout van Rees Sep 12 '11 at 10:12
1

I would avoid specialized recipes like those two whenever possible. There are some cases when a specialized recipe really is needed, but those are cases where the dependency is so egregiously eccentric that no common build/install pattern is usable. I don't know pycairo so that may be the case.

But before assuming it is, try the following. Always try using an egg first by adding it to the eggs option of the relevant buildout part. If that doesn't work, update your question with those details, and then try adding a separate zc.recipe.egg part with build options that may help the distribution build successfully. If that doesn't work or the distribution uses a ./configure && make && make install (AKA "CMMI") build system, update your question with those details, and then try using zc.recipe.cmmi to build the package after which you can use the extra-paths option of your zc.recipe.egg part to include the relevant bits of the CMMI part (extra-paths = ${cmmi-part:location}/weird/path/to/python/modules).

This is the general dance for getting poorly/oddly behaved distributions. If this doesn't work, then a specialized recipe may be in order but in general there's a way to get it to work with the above and that will be much more maintainable.

Ross Patterson
  • 5,702
  • 20
  • 38
  • I agree I want to avoid using recipes. But trust me, Cairo needs it (that's why I Am also asking for an alternative for cairo in this question, but maybe to many questions in 1 post). I have tried adding it to the eggs. The installation will try pycairo and not the wanted py2cairo. Anyway, figuring out how to do this by buildout took me already to many time.... So I hope I can find some more time soon to try your option, but for now I just installed it outside buildout. Thanks for your answer, it looks promising to try this out. (a matter of time before I can vote) – michel.iamit Sep 10 '11 at 13:21
  • It was a difficult choice which answer to choose as the one I accept as an answer. The comment of Reinoud sais it, but you were the first in the first senctence: Do not use this kind of buildout.... I want to avoid as much as possible installing on OS, but for Cairo you have to. – michel.iamit Nov 24 '11 at 12:33