Install python, pygtk in user's space
Question: I am trying to install python with pygtk in my ubuntu system.

I don't have root access so I need to install all the packages locally say
/home/user/local/lib

I am able to install python, but I am not able to link other
packages(pygobject, pygtk, etc) to the locally installed python. And if I try
to install pygtk locally using the command

    
    
    ./configure --prefix=/home/shrihari/local/lib/pygtk2.24/
    

It gives the following error

    
    
    checking for GLIB - version >= 2.8.0... yes (version 2.28.6)
    checking for PYGOBJECT... yes
    checking for gio-types.defs... no
    checking for ATK... yes
    checking for PANGO... yes
    checking for codegen... configure: error: unable to find PyGObject codegen
    

My default python version is python2.4. If I try to import pygtk in python2.4
it works fine but i need pygtk in python2.7. So how can I achieve this? If
there is any good documentation available for installing python, pygtk,
pygobject locally in user space please share.

Thanks in advance


Answer: In general, to be able to link a build to something already installed, you
need to have set up the LD_LIBRARY_PATH and (for Python modules) PYTHONPATH to
the directories where you have installed that "something". So in this example,
if you install Python 2.7 with prefix /home/shrinari/local/python27, you need
afterwards set the system variables like this (for bash):

    
    
    export LD_LIBRARY_PATH=/home/shrinari/local/python27/lib:$LD_LIBRARY_PATH
    export PYTHONPATH=/home/shrinari/local/python27/lib/python2.7/site-packages:$PYTHONPATH
    export PKG_CONFIG_PATH=/home/shrinari/local/python27/lib/pkgconfig:$PKG_CONFIG_PATH
    

And after that you can try to compile something dependent on your new Python
installation. But, according to the configuration error provided, I don't
think this helps in your situation. It seems that you have something missing
from PyGObject, maybe just header files, maybe some module (I don't know
PyGObject specifics). Anyway, why the configure script can not find something
is usually better visible from config.log file which can be found in the build
directory after running the configure script.

