PyFeyn is hosted by Hepforge, IPPP Durham

PyFeyn installation guide

PyFeyn is a standard Python package using the setuptools system, which for the main part behaves just like Python's normal "distutils". For now, installation can only be carried out using the setup.py script - we'll get the automatic easy_install method working soon.

Dependencies

PyFeyn depends on the PyX Python graphics library - you'll have to install it for PyFeyn to work. You can either install it using the methods described on the PyX web page, via an automatic EasyInstall dependency when installing PyFeyn (untested, but should work in principle), or via your operating system's package manager, if it knows about PyX — Ubuntu Linux does, for example, under the name python-pyx.

If you want to have LaTeX output in your Feynman graphs, then obviously you need to have LaTeX installed on your system. If you want to have access to the convenient particle name macros used in the examples, then you'll need to install the LaTeX hepnames package. This in turn requires two other non-standard LaTeX packages, hepparticles and maybemath, but it's worth it!

Installing using setup.py

The "normal" way to install a Python package applies for PyFeyn. There are good instructions in the Python documentation, otherwise my comparably haphazard instructions are below :-)

So, first download and expand the source tarball, then cd to the expanded directory. Now the command that you'll run depends on whether you have root access on your system.

If you do have root access and want to make a system-wide installation, run python setup.py install. This will probably install the libraries into your /usr/local/lib/python2.x/site-packages/pyfeyn directory. That should be all you need to do (please let us know if it isn't).

If you don't have root privileges or for other reasons just want to make a local installation, then you probably want to run the setup.py script with an argument to point at a local Python library directory. The Python docs have a page which specially covers this situation — I'm going to use the "home" scheme here.

We're going to install PyFeyn into a directory within my home directory. I put my local Python libraries into $HOME/local/lib/python, and include this directory in the colon-delimited PYTHONPATH shell variable, by putting the line export PYTHONPATH="$PYTHONPATH:$HOME/local/lib/python" into my .bashrc file. This is standard Python configuration stuff — I hope you can work out the equivalent statement if you use a CSH-type shell.

Now, assuming that you've made such a directory and added it to PYTHONPATH, you should run setup.py as above, but with the --home option: ./setup.py install --home $HOME/local. PyFeyn should now install itself neatly into the lib/python directory in your chosen "home" path.

Installation with easy_install

As the name suggests, the EasyInstall system is a very simple way to install Python packages. PyFeyn now supports network installation using EasyInstall. To use this method, you'll first have to make sure that EasyInstall itself is installed on your system - you can either do this explicitly following the official instructions or, if you're a Linux/BSD/Fink user, via your distribution's packaging system.

Once EasyInstall is installed, and you can run the easy_install executable from your command line, the choice again is whether to install system-wide or locally. If system-side, then you'll need to become root, and run easy_install pyfeyn. This will go to the PyPI package index, download PyFeyn and install it in the system-wide packages directory.

If you want to make a local installation in your home directory, then you'll need to make a directory for Python libraries, say $HOME/local/lib/python, and add it to your PYTHONPATH environment variable. Then run easy_install --install-dir $HOME/local/lib/python pyfeyn and everything should work nicely.

Testing the installation

We don't yet have a proper suite of unit tests, so the best check that PyFeyn has installed properly is to run python and then type import pyfeyn at the Python prompt. If it doesn't complain, chances are it's worked: now try running one of the test examples and check that the output looks okay. Make sure you do the tests somewhere other than the expanded tarball, otherwise Python will use the local sources (in the pyfeyn directory) rather than the installed library.