Python – Installing rsvg lib on second install of Python

gnomegtklibrarypythonrhel5

I have two installs of python on my RHEL server, one at version 2.4.x (which is the general install by RHEL, updated using yum) and a 2.6.x version that I use for Django as well as just everyday scripting (installed from source).

I'd like to get the rsvg library working for Python 2.6.x. It is already present for Python 2.4.x, and stored here /usr/lib64/python2.4/site-packages/gtk-2.0/rsvg.so.

My second python install is here /opt/python2.6.

Ideally, I'd like to do this without having to do a complete reinstall of Python 2.6!

Update

Tried to install the entire gnome-python-desktop package and got

checking for PYGTK... configure: error: Package requirements (pygtk-2.0 >= 2.4.0) were not met.

Seriously, all I want is python-rsvg. It must be possible without installing every single package in the world.

Update #2

I've run this to get what I understand to be the necessary dependencies:

$ yum install pygobject2 pygobject2-devel librsvg2 librsvg2-devel pygtk2 pygtk2-devel

Running ./configure --disable-allbindings --enable-rsvg returns with a message that the only module that will be built is metacity.

Update #3

Trying to install gnome-python-desktop using the configure options provided. Running make results in an error:

metacity.c: In function 'pymetacity_add_constants':
metacity.c:955: error: 'META_CURSOR_MOVE_WINDOW' undeclared (first use in this function)
metacity.c:955: error: (Each undeclared identifier is reported only once
metacity.c:955: error: for each function it appears in.)
metacity.c:956: error: 'META_CURSOR_RESIZE_WINDOW' undeclared (first use in this function)
make[2]: *** [metacity_la-metacity.lo] Error 1
make[2]: Leaving directory `/tmp/gnome-python-desktop-2.13.3/metacity'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gnome-python-desktop-2.13.3'
make: *** [all] Error 2

Running configure on pygobject 2.26.0 (latest stable version ?):

checking for GLIB - version >= 2.22.4... no
*** Could not run GLIB test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GLIB is incorrectly installed.
configure: error: maybe you want the pygobject-2-4 branch?

Running make on glib 2.26.0:

/usr/bin/msgfmt -o test.mo ./de.po; \
    /bin/mkdir -p de/LC_MESSAGES; \
    cp -f test.mo de/LC_MESSAGES
./de.po:15: keyword "msgctxt" unknown
./de.po:15:8: parse error
/usr/bin/msgfmt: found 2 fatal errors
cp: cannot stat `test.mo': No such file or directory
make[4]: *** [test.mo] Error 1
make[4]: Leaving directory `/tmp/glib-2.26.0/gio/tests'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/tmp/glib-2.26.0/gio'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/glib-2.26.0/gio'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/glib-2.26.0'
make: *** [all] Error 2

This is getting pretty frustrating! Is there any way to do this without installing everything?

Best Answer

export PYTHONPATH=/opt/python2.6
export PATH=/opt/python2.6/bin:$PATH

And then configure / make / make install the python-rsvg module (from gnome-python-desktop), and it should just work.

If you want just the rsvg module without the rest, you can use ./configure --disable-allbindings --enable-rsvg.

And make sure you have the librsvg2-devel package installed, or else the module won't build no matter how many --enables you give. :)

Update:

Clearly something is going wrong at the update #2 stage above, where ./configure tells you that it's doing something other than what it says it's going to. Particularly, the metacity bindings are called out in the configure help as being poorly maintained.

I'm not quite sure what's wrong -- is there something helpful in the (long) output from configure? Alternately, you could try to use waf instead of configure/make. Run:

./waf configure --enable-modules=rsvg
./waf
./waf install

(Noting that --disable-allbindings isn't necessary.)

The first line should tell you that only rsvg will be built.

Further Update:

With this approach, you're gonna need pygtk and pycairo built into your /opt/python2.6 tree. That may be why the configure is failing.

Related Topic