WebFaction
Community site: login faq

Hello,

How can I install pygame (http://pygame.seul.org/ - old site is down) on Webfaction?

I'm not familiar with Linux, so I don't know how to compile/config/build/whatever. All I know is it's working on my local Kubuntu installation with "sudo apt-get install python-pygame" but that, of course, fails on Webfaction :)

I'm on web123, if it matters.

Alexei

asked 04 Nov '10, 02:40

Alexei
8136
accept rate: 0%


I was able to get Pygame + SDL installed by doing the following:

# make a temporary directory where we can download and build stuff
mkdir tmp
cd tmp

# download and install SDL
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure --prefix=$HOME
make
make install

# download and extract PyGame
wget http://pygame.seul.org/ftp/pygame-1.9.1release.tar.gz
tar xzvf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release

# Here you need to edit the Setup file and comment out the line that looks like
# _camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
# for some reason the compilation of the camera module fails for me, so I commented it out
vi Setup

# once the camera module is out of the way we can proceed with the installation
# Make sure to use the correct Python version here (e.g. 'python2.5' or 'python2.6')
python2.5 setup.py install --prefix=$HOME

# That's it
permanent link

answered 04 Nov '10, 09:14

tie
1.4k13
accept rate: 44%

edited 04 Nov '10, 10:10

On a CentOS 6 server, I was able to install this easily without any source/Makefile modifications:

mkdir -p $HOME/tmp
cd $HOME/tmp
wget 'http://www.libsdl.org/release/SDL-1.2.15.tar.gz'
tar -xf SDL-1.2.15.tar.gz
cd SDL-1.2.15
./configure --prefix=$HOME
make
make install

cd $HOME/tmp
wget 'http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz'
tar -xf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release
python2.7 setup.py install --prefix=$HOME

Of course, this is the bare minimum for pygame. Lots of its dependencies aren't installed:

Hunting dependencies...
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

So, if you need one of those features, install the appropriate dependency first and then set the environment variables so that the compiler can find them. Here's an example that installs the FONT, IMAGE, and MIXER extensions:

# set up standard build environment
mkdir -p $HOME/src $HOME/tmp
export TMPDIR="$HOME/tmp"
export PATH="$HOME/bin:$PATH"
export C_INCLUDE_PATH="$HOME/include:$C_INCLUDE_PATH"
export LIBRARY_PATH="$HOME/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I$HOME/include $CPPFLAGS"
export LDFLAGS="-L$HOME/lib $LDFLAGS"


###########################################################
# SDL 1.2.15
# original: http://www.libsdl.org/release/SDL-1.2.15.tar.gz
###########################################################
cd $HOME/src
wget 'http://mirror.ryansanden.com/pygame-1.9.1/SDL-1.2.15.tar.gz'
tar -xf SDL-1.2.15.tar.gz
cd SDL-1.2.15
./configure --prefix=$HOME
make -j8
make install

###########################################################
# SDL2_ttf 2.0.11
# original: https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.tar.gz
###########################################################
cd $HOME/src
wget 'http://mirror.ryansanden.com/pygame-1.9.1/SDL_ttf-2.0.11.tar.gz'
tar -xf SDL_ttf-2.0.11.tar.gz
cd SDL_ttf-2.0.11
./configure --prefix=$HOME
make -j8
make install

###########################################################
# SDL_image 1.2.12
# original: https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.tar.gz
###########################################################
cd $HOME/src
wget 'http://mirror.ryansanden.com/pygame-1.9.1/SDL_image-1.2.12.tar.gz'
tar -xf SDL_image-1.2.12.tar.gz
cd SDL_image-1.2.12
./configure --prefix=$HOME
make -j8
make install

###########################################################
# SDL_mixer 1.2.12
# original: https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.tar.gz
###########################################################
cd $HOME/src
wget 'http://mirror.ryansanden.com/pygame-1.9.1/SDL_mixer-1.2.12.tar.gz'
tar -xf SDL_mixer-1.2.12.tar.gz
cd SDL_mixer-1.2.12
./configure --prefix=$HOME
make -j8
make install

###########################################################
# pygame 1.9.1
# original: http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz
###########################################################
cd $HOME/src
wget 'http://mirror.ryansanden.com/pygame-1.9.1/pygame-1.9.1release.tar.gz'
tar -xf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release
python2.7 setup.py install --prefix=$HOME

To go further than this (installing SMPEG, PORTMIDI, and PORTTIME is a lot more involved, because these components have very deep dependencies. PORMIDI depends on ALSA, SMPEG depends on Mesa. You might need to install an entire X11 environment, and there's no guarantee the server has compatible graphics hardware to accommodate Mesa or compatible audio hardware for ALSA.

permanent link

answered 16 Sep '14, 01:10

ryans ♦♦
5.0k93360
accept rate: 43%

edited 18 Sep '14, 02:55

Hi Alexei,

Basically you just need to download the application:

wget http://pygame.seul.org/ftp/pygame-1.9.1release.tar.gz
tar xvf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release
python setup.py install

Note: You will need to change the python command to the python version you want to use.

permanent link

answered 04 Nov '10, 02:51

klynton
1.6k1210
accept rate: 41%

Thanks!

python2.6 setup.py install

Results in:

WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...

Hunting dependencies...
sh: sdl-config: command not found
WARNING: "sdl-config" failed!
sh: smpeg-config: command not found
WARNING: "smpeg-config" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.

I found on a (Ubuntu) forum that I also need to install sdl-config and sdl-dev :(

(04 Nov '10, 04:27) Alexei

I suggest you can install SDL using

http://code.google.com/p/gheat/wiki/PygameInstallation#Standalone_Install

Hope that helps!

permanent link

answered 04 Nov '10, 05:02

neeravk
1.5k3412
accept rate: 41%

As I said earlier, I don't know how to compile/build/make stuff. That's why my local server is Kubuntu, because it makes it easier to install stuff and allows me to concentrate on coding. Thanks, anyway.

(04 Nov '10, 07:40) Alexei
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×2
×2

question asked: 04 Nov '10, 02:40

question was seen: 21,303 times

last updated: 13 Dec '14, 12:09

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM