Compiling pygame for Python3...

Hello all,

I apologize in advance for any greenness on my part or for any breach of forum etiquette. I would like to install pygame for Python3 on my daughter’s openSuSE machine. The machine is currently running openSUSE 13.1 (Bottle) (i586) - Linux 3.11.10-29-desktop. It appears that installing pygame using Yast only installs the Python2 version of pygame. I am having trouble finding detailed instructions on compiling pygame for Python3 under SuSE, so I am somewhat “winging-it” using the Ubuntu procedure. I have successfully download the source. However, when I enter the pygame directory and attempt to compile using “python3 build” I get unresolved dependency issues - see below:

spalm@yoshi:~/pygame> python3 build

WARNING, No “Setup” File Exists, Running “”
Using UNIX configuration…

Hunting dependencies…
/bin/sh: smpeg-config: command not found
/bin/sh: smpeg-config: command not found
/bin/sh: smpeg-config: command not found
WARNING: “smpeg-config” failed!
SDL : found 1.2.15
FONT : not found
IMAGE : not found
MIXER : not found
SMPEG : not found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: not found
PORTTIME: not found
AVFORMAT: not found
SWSCALE : found
FREETYPE: found 2.5.0

Warning, some of the pygame dependencies were not found. Pygame can still
compile and install, but games that depend on those missing dependencies
will not run. Would you like to continue the configuration? [Y/n]:n

I’m having trouble resolving these dependencies. Are they in modules or libraries that I can install from Yast using the software management tools? Or do I perhaps need to download and install some RPMs from elsewhere?

Furthermore, I’m a little concerned by the warning that no “Setup” file exists. Is this a problem? Any help would be greatly appreciated.


Has the porting to Python3 been completed?

Your building with the 1.9.2a0 version?

Hi Malcolm,

I don’t know if it is “fully featured” yet, but it is definitely compilable. Here is the link I am using to the Ubuntu compiling instructions:

Sadly, the compilation instructions for SuSE on the wiki are missing - It’s on the TODO list.

I believe it is pygame version 1.9.2. I grabbed the source by doing an “hg clone” on another machine I have… Then I pushed the whole directory tree over to my daughter’s machine.

My whole motivation for this is that my daughter is learning to program in Python. (Gone are the days of line-numbered BASIC that I remember as a child…) I got her a book by Al Sweigart on game programming in Python. The book uses only Python3, and all the lessons involving graphics and such use pygame with Python3. So I’m assuming it must be operational and reasonably featured at this point.


So does the exist then? The one from here ‘default’ does…

You will need libsmpeg-devel from packman as well for the smpeg-config error. The others are all the relevant devel packages…

Hi there,

I have compiled it successfully, but you have to edit some files.
First of all you have to install libffmpeg-devel
Try to install all necessary depencies

In (and Setup ?) (remark the uppercase ‘S’ at the beginning) you have to remove the PORTTIME parts because it is now completily in portmidi
;remove the complete definition line and the usage from the pypm line

in src/scrap_x11.c are “ISO C90 forbids mixed declarations and code -Werror=declaration-after-statement]” errors
(arount line 158)
add after the line: Time timestamp = CurrentTime;
a line with : XEvent xevent;
and remove ‘XEvent’ 5 lines later
(around line 429)
move the line with “*length 0 = 0;” after the “Time timestamp;” line (here i moved line 429 to 435)

After those corrections I could do the ‘python3 build’ and ‘sudo python3 install’
Pygame on Python 3 works now as espected for me (YMMV because I only use grapic parts of pygame)