12

I'm new to Pi and Linux, and I'm using the Pi Zero W with a fresh version of Raspbian installed. I'm trying to get PyGame installed on the Pi so that I can work on a project. When I run the command

pi@raspberrypi:~/pygame $ python setup.py

This is the output:

No Arguments Given, Perform Default Install? [Y/n]y

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

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

What does this mean in terms of the Pi? What can I do to fix this (some terminal commands would be great, I have no idea how to use the Debian Package Tracking System)

meabster
  • 123
  • 1
  • 1
  • 4
  • Welcome to Raspberry Pi SE. Be sure to take the tour to see how this works and to earn a badge: https://raspberrypi.stackexchange.com/Tour – SDsolar Apr 29 '17 at 08:20

2 Answers2

15

An easy way to find the package providing a given file is apt-file; you can also do much the same thing online from here. First you need to install apt-file:

> sudo apt install apt-file

After that:

> apt-file search "sdl-config"
emscripten: /usr/share/emscripten/system/bin/sdl-config
libsdl1.2-dev: /usr/bin/sdl-config
libsdl1.2-dev: /usr/share/man/man1/sdl-config.1.gz
lush-library: /usr/share/lush/packages/sdl/sdl-config.lsh

You are almost certainly looking for something in a bin directory with no suffix, since this seems to be an in $PATH executable (since it was "not found" using only a base name), which probably excludes the first entry (since that directory is not in a standard $PATH). A more fine tuned way to do this search would be apt-file search "*/bin/sdl-config", which would give you only those two entries.

Anyway, most likely it is the -dev package, so:

sudo apt install libsdl1.2-dev

Should do it.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • "sudo apt install apt-file" should be extended with " && sudo apt update" to get the package cache updated, otherwise the next step doesn't work. – Ville Laitila Jun 27 '20 at 17:30
  • If the call to apt install... worked, then there is already a valid cache. You might as well say that any and all apt commands should be preceded by apt update to work "properly" since the information in the cache may become outdated at any point. In fact, even doing that you are at risk of using an outdate cache because it may have become so milliseconds after apt update completes. – goldilocks Jun 27 '20 at 17:36
0
apt-file search "sdl-config"
emscripten: /usr/share/emscripten/system/bin/sdl-config
libsdl1.2-dev: /usr/bin/sdl-config
libsdl1.2-dev: /usr/share/man/man1/sdl-config.1.gz
lush-library: /usr/share/lush/packages/sdl/sdl-config.lsh

If you get more than one resulting package from your search, you may inspect the found packages for a description with:

apt-cache show <package-name>

libsdl1.2-dev has been chosen by the user, because emscripten and lush-library may pull several other packages from Java or Lisp. Thats a lot of extra stuff you may never use on your Pi.

Darth Vader
  • 4,206
  • 24
  • 45
  • 69
Andur
  • 11
  • 3
  • I don't see any added value in this answer. The existing answer already explains what package the OP needs and how to use apt-file search to find it. – Dmitry Grigoryev Aug 14 '17 at 09:02