29

I am relatively new to linux and am trying to install the pygame dev environment for python. When I run the setup.py it says that I need to install the following dependencies, one of which I found and installed (SDL). However, the others have been more elusive.

Hunting dependencies...
sh: smpeg-config: command not found
WARNING: "smpeg-config" failed!
SDL     : found 1.2.14
FONT    : not found
IMAGE   : not found
MIXER   : not found
SMPEG   : not found
PNG     : not found
JPEG    : not found
SCRAP   : found
PORTMIDI: not found
PORTTIME: not found

If you could give me some guidance I would appreciate it.

Thank you.

Ishtar
  • 11,542
  • 1
  • 25
  • 31
Andy
  • 1,159
  • 5
  • 15
  • 19
  • Have you done an `apt-get update` (not to be confused with `apt-get upgrade`)? When I'm running on anything other than Debian stable, I have to update my repositories regularly. – Wilduck Oct 04 '11 at 19:43
  • Hi Wilduck, I just learned about that recently and had done it earlier. I'm worried that my sources.list may not be up-to-date though. Currently it reads like this: ----------------deb http://ftp.uk.debian.org/debian lenny main *************deb http://security.debian.org lenny/updates main------- I added the * and - symbols to separate the sources – Andy Oct 04 '11 at 20:23
  • If you think your sources.list might be out of date, I would suggest heading over to superuser.com, they'll be able to help diagnose the issue a little better. Good luck. – Wilduck Oct 05 '11 at 14:35
  • 1
    You can refer to this compilation [section](http://www.pygame.org/wiki/Compilation). –  Sep 27 '12 at 07:27

9 Answers9

38

$ sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

Or sorted slightly:

sudo apt-get install \
  python-dev \
  python-numpy \
  subversion \
  ffmpeg \
  libsdl1.2-dev \
  libsdl-image1.2-dev \
  libsdl-mixer1.2-dev \
  libsdl-ttf2.0-dev \
  libavcodec-dev \
  libavformat-dev \
  libportmidi-dev \
  libsmpeg-dev \
  libswscale-dev \
Nick T
  • 25,754
  • 12
  • 83
  • 121
26

Behold, one of the most useful tools on debian-based dsitros:

apt-get build-dep python-pygame

Installs all the dependences required to build pygame :)

On Fedora:

yum-builddep package_name
GuySoft
  • 1,723
  • 22
  • 30
8

For debian, there is a pre-built package available. See here. You should be able to install it with apt-get or something similar.

Constantinius
  • 34,183
  • 8
  • 77
  • 85
  • 1
    Hi Constantinius I downloaded the .deb from the linked site and get a host of dependencies not available. It looks like im missing libsmpeg and libsdl, which I thought I installed sdl already. I think I may be missing some links in my sources.list table and thats why I am missing a lot of packages normall available using apt-get – Andy Oct 04 '11 at 18:54
3

this steps work for me on Ubuntu 16.04:

$ sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev   libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

$ sudo pip3 install pygame
aldajo92
  • 181
  • 1
  • 5
3

My list for Arch Linux:

sudo pacman -Sy sdl_ttf sdl_sound sdl_image sdl_mixer portmidi

danuker
  • 861
  • 10
  • 26
2

If you run one of supported Linux distributions (see "Unix Distributions" section), you just install pygame from a repository, and dependencies are installed, too.

Generally, you need SDL (libsdl and friends), Python, Numpy.

9000
  • 39,899
  • 9
  • 66
  • 104
  • Pygame continues to be elusive, I will work on it a little more today. I'm having trouble finding what the source address would be to put into my sources.list in order to get pygame. – Andy Oct 05 '11 at 12:51
1

on ubuntu 20.04 as of this date I had the SDL missing error and found a solution only to run into a freetype error then had to reinstall because the --user option in the python3 pip command kept me from accessing the module

Here is a one line solution that worked for me with python version 3.8.2:

sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev install libfreetype6-dev && python3 pip -m install -u pygame
robocelot
  • 11
  • 1
1

I (debian buster, python2) recently tried to update pygame from 1.9.4 to 2.0.2, and it seems there has been a switch to newer dependencies compared to the other answers given here, for example from libsdl1.2-dev to libsdl2-dev.

This is what i needed to install for pip2 install --upgrade pygame to go through without error:

sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libportmidi-dev
heslant
  • 23
  • 5
0

Mine is Fedora-20, and I found this worked:

sudo yum install python-opengl
sudo yum install python-devel SDL_image-devel SDL_mixer-devel SDL_ttf-devel SDL-devel smpeg-devel numpy subversion portmidi-devel 

Downloaded the smpeg from the website:

http://freecode.com/projects/smpeg

and did a local install:

sudo yum localinstall smpeg-0.4.5-2.1.x86_64.rpm 
sudo yum install pygame pygame-devel
Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
Peter Teoh
  • 6,337
  • 4
  • 42
  • 58