pygame installation: sdl-config command not found
Solution 1
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
Solution 2
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!! =)
Solution 3
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
Solution 4
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
Solution 5
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
./configure
sudo make all
Admin
Updated on October 18, 2021Comments
-
Admin over 2 years
I used
./configure --prefix=$HOME make 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.
-
GTK 1.2.6 fanboy almost 4 years+1, this simple solution will be useful for many even if I had to install more than 100 MB of additional packages just for the "Alien Invasion" project...
-
Corpse almost 4 yearsFinally! I tried every other answer and nothing worked. This finally worked. thank you
-
moudrick over 2 yearsPySDL2 returns 404
-
furas over 2 years@moudrick this answer is 8 years old. It seems author removed
PySDL2
from this URL. But if you use Google then you should find new place. pysdl2.readthedocs.io/en/rel_0_9_7. BTW: as I know currentPyGame
usesSDL2
-
matanster over 2 years@GTK1.2.6fanboy better be prepared for the invasion than scrambling to install those extra MB in a rush as it happens, I guess :)