pymedia on Ubuntu Hardy Heron

Recently, I needed to use pymedia, for some audio and video encoding. The problem though, is that pymedia was nowhere to be found in the Ubuntu Hardy Heron package repository, and the only .deb installation candidate from the pymedia website was for an older version of pymedia and Python 2.4. Not wanting to run an old version and having Python 2.5 as a requirement, I needed to compile the package myself--no easy task, it turns out.

Step 1: Get pymedia

tar xzvf pymedia-
cd pymedia-*

Step 2: Get the pymedia dependencies

As noted here.

sudo apt-get install python-dev libogg-dev libvorbis-dev liblame-dev libfaad-dev libasound2-dev python-pygame

Step 3: Get GCC 3.4

Note pymedia will not compile with GCC 4.0.

sudo apt-get install gcc-3.4 g++-3.4
export CC=gcc-3.4

Step 4: Build/compile pymedia

python build

Step 5: Be a good Ubuntu user with checkinstall

Checkinstall is great because it installs the package as a .deb file.

sudo apt-get install checkinstall
sudo checkinstall python install

Note: If you want to be a bad Ubuntu user, you can run "sudo python install" instead of the checkinstall command.

Step 6: Try it out

>>> import pymedia