a portable linux python
Plipy is a suite of tools for building and managing a portable linux python environment. It aims for a plipy environment to run on most major linux dsitros in use today, as well as a good number that should have been phased out of use many years ago. It’s similar in spirit to portable python but targeting linux instead of Windows.
The secret sauce is basically:
Using the autopackage build tools to hide newer glibc symbols, so that compiled libs can be used unmodified on older linux boxen.
Setting the rpath on all shared libs to a sensible value, so that their deps can be found regardless of where the plipy env is located.
Building a plipy environment
To build a plipy environment, you’ll need at least a recent gcc version and the “chrpath” tool. Initialise a new plipy env with the following command:
#> plipy PATH/TO/ENV init
This will build and set up a basic python installation (currently python 2.6.5) along with setuptools and pip. Most python packages can be installed directly using pip. For packages with more complex needs a plipy “recipe” is provided, and you can install them using e.g.:
#> plipy PATH/TO/ENV install py_wxpython
This would build and install a custom wxPython version that is patched to be more portable.
Using a plipy environment
In the top level of a plipy environment there are three shell scripts named “python”, “plipy” and “shell”. These set up some relevant environment vars and then chainload the appropriate command.
Here’s how you might install a third-party package using pip:
#> #> PATH/TO/ENV/shell plippy(ENV):$ plippy(ENV):$ pip install esky ...lots of output as esky is installed... plippy(ENV):$ plippy(ENV):$ <ctrl-D> #>
What is it good for?
Why, everything that something like portable python is good for, except on linux instead of Windows! Use it as a convenient portable scripting or testing environment, or to run multiple python versions side-by-side.
One thing it’s particular good for (actually, the reason it was created) is building frozen Python apps on linux. Plipy comes with recipes for patched versions of cx-freeze and bbfreeze that will build stand-alone applications having the same portability as the plipy env itself - meaning they should run anywhere from ancient Red Hat distros to the latest Ubuntu release.