• Uncategorized

About python : pygame-installation-sdl-config-command-not-found

Question Detail

I used

./configure --prefix=$HOME
make install

to install sdl2,
after which I tried to install pygame by

cd ../pygame-1.9.1release/
python setup.py install

but I am getting an error:

linuxnx:~/python/library/pygame-1.9.1release> python setup.py install
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.

Question Answer

I searched a long time, cause I needed the package for Python Crash Course by Eric Matthes, but couldn’t find the answer that would help running
pip install pygame
without errors and finally found 1 line solution that worked for me

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 libfreetype6-dev

I’m seeing that this thread has been around for a long time, but I think it’s a good idea to leave this here in case it helps someone.
I found these lines on a website that might help:

At the moment, 5/1/2020, you cannot install the pygame libraries in
python 3.8 with pip install pygame, bu you can install them with a
particular version of them, still for dev. You can install Python 3.8
in the command line using this version: pip install pygame==2.0.0.dev6
Latest version: pip install pygame==2.0.0.dev10

I don’t know if you use python3 but it throws me more errors apart from sdl
as well as freetype-config … Before I used “python3 -m pip install pygame”.

:~$ python3 -m pip install pygame==2.0.0.dev10
Collecting pygame==2.0.0.dev10
  Downloading pygame-2.0.0.dev10-cp38-cp38-manylinux1_x86_64.whl (14.3 MB)
     |████████████████████████████████| 14.3 MB 130 kB/s
Installing collected packages: pygame
Successfully installed pygame-2.0.0.dev10

Nice programming time for all!! =)

ORIGINAL: 2013.10.25

PyGame-1.9.1 was created in 2009 so it still use old SDL 1.2 not new SDL2.

PySDL2 use SDL2

EDIT: 2021.10.17

Question and my original answer is almost 8 years old and it seems author removed PySDL2 from URL in my old answer. He moved code from bitbucket to github

Using Google I found

  • doc: https://pysdl2.readthedocs.io/
  • pypi: https://pypi.org/project/PySDL2/
  • github: https://github.com/marcusva/py-sdl2

And meanwhile PyGame started to use SDL2.

  • Pygame.org: pygame 2 — 28 Oct, 2020
  • GitHub: Release note

See also all releases

Try this in the terminal , It should installs the sdl 1.2
# 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
sudo make all

After I read top answer above,

I installed python-dev, libsdl-image1.2-dev.

Then I got

Hunting dependencies...
WARNING: "pkg-config freetype2" failed!
WARNING: "freetype-config" failed!
SDL     : found 1.2.15
FONT    : not found
IMAGE   : found
MIXER   : not found
PNG     : found
JPEG    : found
SCRAP   : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: not found
Missing dependencies

So I just installed these and it worked.

sudo apt install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libportmidi-dev libfreetype6-dev

This error showed up once again in Pygame-2.0.0.dev12

The solution for me was:

sudo apt-get install libsdl2-dev

Then I got

Hunting dependencies...
SDL     : found 2.0.9
FONT    : not found
IMAGE   : not found
MIXER   : not found
PNG     : found
JPEG    : found
SCRAP   : found
FREETYPE: found 22.1.16

So I ran this command below:

sudo apt-get install libsdl2-mixer-dev libsdl2-image-dev libsdl2-ttf-dev

To wrap up the missing dependencies

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.