Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install pycairo for python 3 on Ubuntu 10.04

i am trying to install pycairo 1.10.0 for use with my custom-build python 3.1. however,

sudo /flower/bin/easy_install-3.1 pycairo

fails with

XXX@XXXX:/adventures$ sudo /flower/bin/easy_install-3.1 pycairo
install_dir /flower/lib/python3.1/site-packages/
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-zeG9HB/pycairo-1.10.0.tar.bz2

and indeed, there is no setup.py in the said download; instead, the INSTALL says:

Install Procedure
-----------------
$ ./waf --help     # shows available waf options
$ ./waf configure  # use --prefix and --libdir if necessary
                   # --prefix=/usr --libdir=/usr/lib64  for Fedora 64-bit
$ ./waf build
$ ./waf install

Use
$ python3 ./waf ...
if you have python2 and python3 installed, and the default is python 2.


Testing
-------
See test/README

i understand that as telling me that i should

sudo /flower/bin/python3.1 ./waf configure --prefix=/flower/pycairo/

or similar; however, this leads to the following error:

  ./options()
Setting top to                           : /tmp/pycairo-1.10.0 
Setting out to                           : /tmp/pycairo-1.10.0/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/bin/python 
python executable '/usr/bin/python' different from sys.executable '/flower/bin/python3.1'
Checking for python version              : (2, 6, 5, 'final', 0) 
The python version is too old, expecting (3, 1, 0)

so i went down into the source code; there is seemingly no way to tell this waf thingie that the targetted python version is simply the one it runs on itself, so i fumbled around and got as far as this:

Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/bin/python 
#############293 /flower/bin/python3.1
Checking for python version              : (3, 1, 2, 'final', 0) 
Checking for library python3.1 in LIBDIR : yes 
Checking for program python3.1-config    : not found 
Checking for program python-config-3.1   : not found 
Checking for header Python.h             : Could not find the python development headers 
Checking for []                          : not found 
The configuration failed

i do in fact have a file /flower/bin/python3.1-config so i don't get it. the python code that does all this is rather hard to handle.

any suggestions how to go on? is there a *.deb or similar ready for pycairo + python 3? couldn't find any.

like image 784
flow Avatar asked Jun 03 '11 20:06

flow


People also ask

How install Pycairo Linux?

Installing Pycairo requires pkg-config and cairo including its headers. Here are some examples on how to install those for some platforms: Ubuntu/Debian: sudo apt install libcairo2-dev pkg-config python3-dev. macOS/Homebrew: brew install cairo pkg-config.

What is Pycairo in Python?

Pycairo is a Python module providing bindings for the cairo graphics library. It depends on cairo >= 1.15. 10 and works with Python 3.7+. Pycairo, including this documentation, is licensed under the LGPL-2.1-only OR MPL-1.1.


1 Answers

By looking at the python.py file in that subdir I decided to try setting an environment var before executing the waf thru python3:
export PYTHON="python3"
And then the install mysteriously succeeded...

like image 154
Michael Joost Avatar answered Sep 19 '22 22:09

Michael Joost