1

I have developed a pygtk application and i need to release it to customers. I am using python 2.7, pygtk 2.2 in ubuntu.

My question is how can I bundle the required packages(python, pygtk, gobject) together with my application, so that even if these packages are not installed in client machine I can run my application.

I tried with pyinstaller but, the executable depends on the glibc i.e executable created with higher glibc version will not work with the machine which has lower glibc version.

So is there any way to create a release directory which includes all the packages required so that I can run my application in any system without installing the packages.

Thanks in advance,

user2109788
  • 1,266
  • 2
  • 12
  • 29
  • Download all the necessary sources and write a makefile. – michaelmeyer Mar 05 '14 at 08:11
  • What should be added in the makefile? I cant install the packages since I will not have the permission to do so. Can you provide any documentation/example? – user2109788 Mar 05 '14 at 08:26
  • Can't you do an install to a local prefix? (like ~/.local/) – Valentin Lorentz Mar 05 '14 at 09:39
  • @Valentin I haven't tried that. It would be better if i'm able to run the application without installing the packages. Usually customers will hate installing new packages into their system(even locally) because they feel that it will affect other modules/packages in their system. But can you provide any good links which explain how to install packages locally? May be statically too? and how can I setup pygtk like packages to statically installed python versions? – user2109788 Mar 05 '14 at 12:40
  • 2
    Installing to a local prefix is just like copying files from a location to another. To change the installation prefix, most software provide a way to do it easily, see the doc (`./configure --prefix=$HOME/.local/` for autotools, `cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/.local/` for cmake, …) – Valentin Lorentz Mar 05 '14 at 15:29
  • @Valentin Thank you. I will give a try once. And any idea how can I run without installation? Like, I have the packages needed in my release directory and setting environment variables before running the application.. Is this possible? – user2109788 Mar 06 '14 at 05:46
  • When one compiles (actually, it's when linking) a program, the output binaries are designed to work when at a given place (which depends on the prefix). Installation is *only* putting binaries at that place, so you can't skip this step. – Valentin Lorentz Mar 06 '14 at 12:23

1 Answers1

0

Just adding the solution to my own question!

As suggested in the comments above installed packages by downloading the source and compiled them in a machine which had glibc2.5 then created binary executable of my pygtk app using pyinstaller

I had tried compiling packages earlier also, but weren't checking the ./configure output properly. The problem was, I was trying to install gtk and pygtk without installing cairo and pango. So pygtk skipped building gtk packages because it did not find any cairo package. This was mentioned in the ./ configure script but I had not checked that.

Summarizing:

To configure pygtk to python need to folow these steps

  1. install sqlite-devel #If sqlite needed
  2. install python(2.7)
  3. install gtk(2.24.0) -> requires glib(2.27.3), atk(1.29.2), cairo(1.8.10), pango(1.22.4), gdk-pixbuf(2.21.3)
  4. install pygtk(2.24.0) -> requires pygobject-2.28.3, pycairo(1.8.10)

All the above packages must be compiled to the same prefix, and need to set the PYTHON and PATHONPATH environment variables. The versions of packages also play major role. Added version in parenthesis that worked for me.

There are many dependencies while installing some of the packages so I had to install following packages using yum: libxext, librender, gettext, zlib, libgtk2-devel

user2109788
  • 1,266
  • 2
  • 12
  • 29