Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted
+25
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.

share|improve this answer
    
The problem is getting my hands on python-rsvg. I'd rather not have to install all of gnome-python-desktop if possible, especially since I'd basically have to do it from source. –  Jordan Reiter Dec 6 '10 at 17:41
    
Quick answer: ./configure --disable-allbindings --enable-rsvg should just build the part you want. –  mattdm Dec 6 '10 at 18:02
    
Longer comment: The state of python SVG bindings is pretty much embarrassing, especially compared to Batik over in the Java universe. I don't think python-rsvg has a life outside the gnome-python-desktop package. It's kind of bizarre, really. Fortunately, building from the gnome desktop source package isn't much work. (Make sure you have librsvg2-devel installed, by the way, or the above will fail, with the only error message way back in the middle of the ./configure output, and you'll be left with only a skeleton directory and no actual module.) –  mattdm Dec 6 '10 at 18:03
    
So no matter what I need to install pygtk? And, apparently, pygobject as well? –  Jordan Reiter Dec 6 '10 at 20:02
    
Yeah, because those are dependencies of the rsvg module. You're also going to need pycairo. (Look at the first few lines of rsvgmodule.c and you can see that pygobject.h and pycairo.h are included.) As horrible dependency chains go, this one isn't actually too bad. –  mattdm Dec 6 '10 at 20:31
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.