eGenix PyRun - One file Python Runtime

eGenix PyRun™
is our one file, no installation version of Python, making the
distribution of a Python interpreter to run based scripts and
applications to Unix based systems as simple as copying a single file.

The executable is only 11MB in size, does not require a system wide installation, but still supports most Python application and scripts.

Compared to a regular Python installation of typically 100MB on disk,
eGenix PyRun is ideal for applications and scripts that need to be
distributed to several target machines, client installations or
customers.

It makes "installing" Python on a Unix based system as simple as copying a single file.

eGenix has been using the product internally in the mxODBC Connect Server
since 2008 with great success and decided to make it available as a
stand-alone open-source product.

We provide both the source archive to build your own eGenix PyRun, as well as pre-compiled binaries for Linux, FreeBSD and Mac OS X, as 32- and 64-bit versions.

If you'd like to learn more about eGenix PyRun, please see the talk
we gave at the EuroPython 2012 conference in Florence. You can find the
video of the talk on YouTube:

Compatible with setuptools/distribute, easy_install, pip:
Great care was taken to make sure that PyRun can be used with
setuptools et al. Please note that these tools are not designed to be
relocatable.

In simple words, you are free to use the software without paying
fees or royalties as long as you give proper attribution and keep the
license documents together with the software. Please see the license
document for details and consult a lawyer if you have legal questions.

Please enable JavaScript to be able to download the software packages !

Quick Install

If you want your Unix system to automatically download and install
PyRun into a directory, you can use a script that we've written for this
purpose. It's called install-pyrun and will detect the correct version for your system, install it and then proceed with the installation of distribute and pip. Try it:

Source Code (to build your own eGenix PyRun):

Other Platforms:

If you need binaries for platforms not mentioned here, please contact support@egenix.com for details. It is very likely that we can find a way to help you.

Python Unicode Version (UCS2 vs. UCS4)

Python can be built as narrow Unicode version (UCS2) or wide
Unicode version (UCS4).

If you want to interface to system installed Python libaries, you
need to download the right variant for your platform. Most Unixes ship
with wide Python builds these days (including
RedHat and SuSE). In order to make sure, please run the following
command which will tell you what kind of Python installation you have:

python -c "import sys;print(sys.maxunicode<66000)and'UCS2'or'UCS4'"

If you get errors such as "unresolved symbol PyUnicodeUCS2_AsEncodedString" when trying to load an extension from eGenix PyRun, you have likely installed a binary for different Unicode version.

Windows Installer

eGenix PyRun currently does not support Windows platforms.

Prebuilt Binary Distribution

Simply download a suitable binary distribution for the version of
Python and platform you need and extract it to a base directory where
you'd like PyRun to live. Then use the eGenix PyRun executable like
you'd use a
regular Python interpreter, e.g.

./bin/pyrun2.7 myscript.py

You can also put pyrun into the shebang of the script, e.g.

#!/usr/bin/env pyrun2.7# Hello World Demoprint "Hello World!"

Please note that the binary distributions contain more than just the
PyRun executable. They also come with a few extra standard library
extensions which are normally not part of PyRun and the include files
needed to compile Python extensions for use with PyRun.

If you are just looking for the plain single-file PyRun executable, only extract the file bin/pyrunX.X (with X.X being the
underlying Python version, e.g. 2.7) from the binary distributions.

virtualenv replacement: install-pyrun script

To further simplify installation of eGenix PyRun, we've created a
bash script which you can use to easily install PyRun in a similar way
to how you'd use the virtualenv script. The script is called install-pyrun and available from our download server.

The script will download the right PyRun binary distribution for your
platform, install it in the targetdir and then download and install distribute and pip.

The script also offers a few options to adjust various parameters,
install PyRun from a local directory, select a specific version, skip
installation of distribute and pip, etc. The script will output a list
of options when run with -h:

It
uses curl to download the packages, so you need to have curl installed
on your platform.

eGenix PyRun Directory Structure

If you want to install other libraries or packages for use in
eGenix PyRun, you need to pay a little more attention to where you copy
the executable. eGenix PyRun assumes the following directory layout relative to the executable (with X.X being the
underlying Python version, e.g. 2.7):

bin/pyrunX.X
lib/pythonX.X
include/pythonX.X

The lib/pythonX.X directory is used as location of the Python
libaries and automatically put on sys.path in case it is available. Optional packages installed through distutils or setuptools will go into the corresponding lib/pythonX.X/site-packages/ directory.

The lib/pythonX.X directory may also contain Python standard library extension modules in the lib-dynload/
sub-directory which are not integrated into the eGenix PyRun
executable. The prebuilt binary distributions come with a set of
such extensions.

The include/pythonX.X directory is only needed in case you want to
compile Python C extensions. It is available as
part of the prebuilt binary distributions we make available.

Building you own eGenix PyRun binary

In order to build your own version, simply download the above
source archive, untar/unzip it to a temporary directory and follow these
steps:

cd egenix-pyrun-*cd PyRunmakemake install

This will download the Python source distribution and start a build
of eGenix PyRun. The result will be installed to the directory /usr/local/ using the directory layout as described above.

If you'd like to build a binary distribution archive, use the following commands instead:

cd egenix-pyrun-*cd PyRunmake distribution

You can then pick up the distribution archive from the dist/ directory.

Customization Options

If you would rather install to a different directory, you can add the make parameter PREFIX=/path/to/pyrun/, This will cause make to install eGenix PyRun in /path/to/pyrun/.

If you want to build against a specific Python version, you can specify the version using the make parameter PYTHONFULLVERSION=2.7.3. Please have a look at the PyRun/Makefile for more ways of customizing the setup.

For future versions of eGenix PyRun, we plan to make the setup
customizable via a top-level setup.py file so you can use Python to
trigger the build, customize the included standard lib extension modules
and installation.