Skip to main content

kubuntu — wiki

How to install pygame from source onto Ubuntu/Kubuntu

There are two solution to this problem, one using apt-get and one using a manual installation.

Apt-get installation

Ubuntu has a pre-built version of pygame available to you. The actual pygame version is dependent on the Ubuntu version you're running:

Hoary includes pygame 1.6
Run "sudo apt-get install python2.3-pygame". (someone should confirm this is the correct version)
Dapper includes pygame 1.7.1
Run "sudo apt-get install python2.4-pygame".
Hardy includes pygame 1.7.1
Run "sudo apt-get install python-pygame".

Manual installation

There are all kinds of problems when you run "python setup.py install" and this is what I did to fix that:

link to ubuntuforums where the drama played out: here

  • Fetch the "build-essential" package with kynaptic/synaptic.
  • You might need to also fetch "gcc" (Not sure, it should come with 1)
  • Fetch "python2.4-dev" and, for good-measure, "python2.3-dev"
  • Fetch the latest versions of libsdl-image, libsdl-mixer, libsdl-ttf, libsmpeg0 as well as all the XXX-dev versions of all those same libs.
  • Then proceed to install the pygame source as per the readme in the source.

All should proceed just fine. I can't give you a total solution because of the round-about way that I got it working, but that's the gist of it.

I include here the information about making a deb file that I got on the forum:

Bear in mind the packages I listed above must still be installed for this to work.

I would recommend you download the source package from Debian and rebuild that for Kubuntu.
Going through that process will ensure that you have the right build-deps, and will ensure that the final package is consistent with Debian's python conventions.

The main steps involved are:

  • Download the three files the bottom of Debian's page for the pygame source package.HERE
  • Use "dpkg-source -x pygame_1.7.1release-1.dsc" to unpack the source tarball and apply debian-specific patches. dpkg-source is in the dpkg-dev package.
  • Go into the directory which is created in the previous step and run "dpkg-buildpackage -rfakeroot". (You need to install the fakeroot package for this).

There will probably be a couple of false starts as the build process identifies build-dependencies which you don't have. You can shortcut this by reading the .dsc file. If all goes well you will end up with the deb files you need to install pygame onto your system.

Thanks toojays.