Installation Guide

VIFF is written in Python and uses the Twisted framework for asynchronous communication, (optionally) OpenSSL and PyOpenSSL for secure communication, and GMPY for fast bignum arithmetic. You can find these components here:

Python:http://python.org/
Twisted:http://twistedmatrix.com/
OpenSSL:http://www.openssl.org/
PyOpenSSL:http://pyopenssl.sourceforge.net/
GMPY:http://code.google.com/p/gmpy/

VIFF has been successfully tested with the following versions:

Python:2.4.1 – 2.6.0 (3.0 is not yet supported)
Twisted:2.5 – 8.1.0
OpenSSL:0.9.8g
PyOpenSSL:0.7 – 0.8
GMPY:1.0alpha – 1.0.3

Please report back if you find that VIFF works with other versions than the ones listed here.

Below you will find installation instructions for the different platforms on which we test VIFF.

Windows

This describes the installation procedure for VIFF on Windows. It has been tested and verified on Windows XP Professional 2002 SP2 and Windows Vista Ultimate SP1.

  1. Download and install Python.
  2. Include the path to your Python installation (e.g. C:\Python25\) in the PATH system environment variable. One way to edit this environment variable is by right-clicking My Computer in the Start menu, selecting Properties, Advanced, and then pressing the Environment Variables button.
  3. Download and install Twisted.
  4. Download and install GMPY. If you are using Vista, right-click on the installer and choose the option to run as administrator.
  5. Download and execute an OpenSSL Win32 Installer. Problems have been reported when using the latest release, 0.9.8h, so currently 0.9.8g is recommended.
  6. Download and install PyOpenSSL. Again, run the installer as administrator if you are using Vista.
  7. Download and install VIFF. Note that if you are using the installer on Vista, you will again need to run it as an administrator.
  8. Proceed to testing.

Mac OS X

This describes installation of VIFF on Max OS X 10.5.

  1. Download and install the full MacPython version 2.5 (the Python-installation which comes with Mac OS X is not entirely up-to-date).

  2. Download and Install Twisted from source. There is an installer for Mac OS X 10.5 which can be used if you use Mac OS X 10.5. Notice again that Mac OS X comes with a pre-installed version of Twisted, but this is not the full Twisted installation. After installation change your PYTHONPATH (in your ~/.bash_profile) to:

    export PYTHONPATH="/Library/Python/2.5/site-packages:${PYTHONPATH}"
    export PYTHONPATH=$PYTHONPATH:$HOME/opt/lib/python
  3. Optionally: download PyOpenSSL and tell us if it works!

  4. Download and install GMP. You can preferably use the Macports or Fink package utilities. If you download the other dependencies from either Macports or Fink, they might depend on Python 2.4 which is not preferable, you should use Python 2.5, unless you have good reasons not to.

  5. Download and install GMPY following the instructions in gmpy-1.02.macosx.README.txt (under Downloads).

  6. Install VIFF from source. If you prefer you can just install it in site-packages, it makes no difference.

    For developers, either add VIFF to the PYTHONPATH:

    export PYTHONPATH=$PYTHONPATH:$HOME/path-to-viff/viff

    or create a symbolic link from the site-packages directory to the VIFF Python files (viff/viff/), as otherwise you need to re-install VIFF each time the project is modified.

  7. Proceed to testing.

GNU/Linux

VIFF was originally developed on GNU/Linux and is well supported there. When installing the VIFF dependencies you either have the option of using your package manager or to install from source. VIFF itself must be installed from source.

Using a Package Manager

Debian

You can install all dependencies by the command:

aptitude install python-twisted-core python-pyopenssl python-gmpy
Ubuntu
Install the python-twisted-core and python-gmpy using Synaptic package manager. This will automatically pull in python-pyopenssl as a dependency.
Gentoo

The following command will install the dependencies:

emerge -av twisted gmpy

Make sure to have the crypt use flag enabled, otherwise SSL might not be available.

If you know how to install using other package managers, please let us know.

VIFF itself is not yet packaged for any distribution, so you will have to install it from source as described below.

Installing from Source

If you do not have permission to use the package manager or simply prefer to install from source, then (assuming that Python is already installed) one can easily install VIFF and its dependencies by downloading and unpacking each of them and executing:

python setup.py install --home=$HOME/opt

That will install everything under the given prefix. With the above command the Python modules are installed into:

$HOME/opt/lib/python

You should add the directory to the PYTHONPATH environment variable. Bash users can normally do this by adding:

export PYTHONPATH=$PYTHONPATH:$HOME/opt/lib/python

to their ~/.bash_profile file, creating it if it is not already there. Consult the documentation for your shell to learn how environment variables are set.

If you are doing development on VIFF, you might prefer to make a symlink from the viff folder in your repository to a place in your PYTHONPATH, like this:

sudo ln -s ~/viff/viff /usr/lib/python2.5/site-packages/viff

Testing

To verify the installation, try out one of the applications. We will run the millionaires example with three players and a threshold of one. For this test, we will let all players run on localhost: Player 1 will run on port 9001, player 2 on port 9002, and player 3 on port 9003. The test is done on Windows, but it works the same on the other platforms. Do the following:

  1. Go to the viff/apps/ directory and generate the needed configuration files by entering:

    python generate-config-files.py -n 3 -t 1 \
    localhost:9001 localhost:9002 localhost:9003

    The backslash indicates that both lines should be typed as a single line in the terminal.

  2. Open three separate command prompts and go to the viff/apps/ directory in each. In the first, type:

    python millionaires.py --no-ssl player-1.ini

    in the second, type:

    python millionaires.py --no-ssl player-2.ini

    and in the last, type:

    python millionaires.py --no-ssl player-3.ini

    The order in which you start the players does not matter. They should find each other within a couple of seconds after you have started the final player.

    If the installation works, you should see something like this from e.g. player 3:

    C:\viff\apps> python millionaires.py --no-ssl player-3.ini
    Seeding random generator with random seed 7416
    Not using SSL
    I am Millionaire 3 and I am worth 20 millions.
    From poorest to richest:
      Millionaire 2
      Millionaire 3 (20 millions)
      Millionaire 1
    Initiating shutdown sequence.

    If something went wrong, then please file a bug report or report it on the VIFF mailing list. This will help us improve VIFF.

    If things worked as they should, then you are also very welcome to send a mail saying so to VIFF mailing list! We would love to hear your feedback.

Table Of Contents

Previous topic

Overview

Next topic

Applications

This Page