Silva SciDAV: Not really an acronym · How to Install Software for Science · Installing VisionEgg was Hard!

Installing VisionEgg was Hard!

But now, it's only a little challenging. Try it and see! Be sure to read the appropriate "First Steps" for your system, then continue on to "Actually Installing VisionEgg" below that. There are some other notes at the end as well. Note that you will need a C compiler to install VisionEgg, described in Setup for Developing / Building.

In the text on this page, I've set links to open up new windows. Normally, I don't like this kind of thing, but in this case I think it's useful - as you can keep these instructions open while you download and install things. Drop me a line if you disagree!

First Steps for a Mac

The most fundamental thing is your python installation:

Enthought Python Distribution 
Download from http://www.enthought.com/products/epd.php. You can just let it install the defaults - this will fix your PATH among other things.  If you'd rather handle that yourself, be sure to do a custom install (if you don't know what "PATH" is, do the default!).

Now, we are a little sneaky.  Pygame only wants to install to a python.org style install of python 2.X. EPD makes a version based on the EPD version, not the python version. So, we make a symlink by typing the following into a command-line prompt (like in Terminal.app):

cd /Library/Frameworks/Python.framework/Versions
sudo ln -s 6.0.0 2.6

Of course, you should replace "6.0.0" with whatever your EPD version is, and if your EPD contains a newer python (e.g. 2.7), use that as the second argument. 2.6 is working pretty well as of February 2010. Unless you have a reason to delete it, leave that link there.  It'll make other installers work too!

Now, you can run the installer from http://pygame.org/download.shtml, and be sure to get the appropriate version for your python. (You likely want the one for python 2.6, and pygame versions 1.7 through 1.9 seem to work fine. 1.9 has some nice new features that some others in my lab seem to like.)

First Steps for Ubuntu (and probably Debian, etc.)

First, you are running Ubuntu, you absolutely need to understand package management. The two best solutions are aptitude on the command line and synaptic for a graphical interface. I imagine the Kubuntu guys have their own thing that isn't as well-supported, but if that's your thing, you probably already know about it.

Assuming you have learned the basics of package management described above, you can easily install the following packages and you're done:

If you followed the general instructions for installing Python packages, you've already installed these, but you'll also need the python development headers, etc. as well as setuptools:

You may, however, want to install non-standard versions of these things. In particular, some older versions of Ubuntu ship a beta version of PyGame which is incompatible with VisionEgg. You may also need to download the appropriate version of pyopengl for visionegg.

Dependencies for Building PyGame

You'll also need the "development" versions of the SDL libraries. When I wrote this, the ones I had to install were:

This will install all kinds of other stuff. Don't worry about it - these files are tiny, and your package manager will actually remove those packages if you remove the libsdl stuff. Note that SDL supports fonts both via the older ttf (TrueType font) and the newer Pango libraries. PyGame likes ttf for now (as of 1.9.1), and will ignore the Pango libs.

The is also MIDI support via portmidi (which we don't generally need for science), but if you want that, you'll also need

Downloading and Building PyGame

If you don't have the basics yet, please read the general instructions on installing python packages from source.You can get the .tar.gz file from http://pygame.org/download.shtml. Since pygame has a bunch of dependencies, it IS useful to simply run the build portion of setup.py first, i.e.:

python setup.py build

Specifically, you probably don't care about  PORTMIDI / PORTADAPT for MIDI support. Once you have a successful build, go ahead and install and test the package.

First Steps for Windows

Just use the binary installers, including the one for VisionEgg. Getting a C compiler working for this is simply a pain in the butt.



                                         

Actually Installing VisionEgg

Lastly, you need to install the VisionEgg from http://sourceforge.net/projects/visionegg/files/visionegg/. Just download the most recent tarball and follow the general instructions on installing python packages from source.

You're done! Try some of those demos there in the "demo" directory.  People seem to like multi_stim.py.

Other Stuff You Might Like

PyYaml

If you're using my extensions to VisionEgg (which you probably aren't), you will need to install PyYaml as well. Just follow the directions at http://pyyaml.org/wiki/PyYAML.

LabJack support

You'll want to install both the binary OSX kernel driver from http://labjack.com/, as well as the LabJackPython code from GitHub (also linked from the LabJack site). It doesn't matter what order you install these in, as the python code just uses ctypes and all binding occurs at runtime. The kernel driver is a standard mpkg installer. You'll probably get a tarball from GitHub, and it will have some crazy long name (actually a reference to the specific Git revision), but pay no mind and just unpack it like any old tarball and follow the instructions for installing python packages from source.

There's apparently another version which uses PyUSB and a simpler kernel driver, but given that you need to install a kernel driver anyway, I don't see the point of the PyUSB solution (except as an exercise).

Some final notes

If you've used python with a large stack of installed libraries, you may notice that EPD 5.0+ is very fast (relatively, anyway).  This is because they are avoiding the use of python "eggs." These are the marginally convenient packages used by easy_install and company. Sadly, while they are convenient, they require significant processing at startup to fix the import mechanism. We went ahead and installed an egg for pygame, and this was (maybe) worth it, because we also get the SDL libraries and so on installed at once. But generally, you should probably avoid them.