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
wget http://internap.dl.sourceforge.net/sourceforge/pymedia/pymedia-1.3.7.3.tar.gz
tar xzvf pymedia-1.3.7.3.tar.gz
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 setup.py 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 setup.py install
Note: If you want to be a bad Ubuntu user, you can run "sudo python setup.py install" instead of the checkinstall command.
Step 6: Try it out
python
>>> import pymedia