I downloaded an sd card image by Ubiquity Robotics which is an Ubuntu OS with ROS preinstalled onto my Raspberry Pi. This image creates a pifi access point for the Raspberry Pi and allows me to ssh into the Raspberry Pi by connecting my laptop to the access point created and doing ssh [email protected]. Now then I tried connecting to my home router by using pifi add <ssid> [<password>] and then sudo reboot. I was able to connect to my home router this way. So after this I tried downloading the library I needed, pygame. So i typed sudo apt-get install python3-pygame

And this is what i got:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python3-pygame is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

So I went to a pygame site and tried downloading the library another way:

sudo apt install libsdl2-dev libfreetype6-dev libsdl2-mixer-dev libsdl2-image-dev libsdl2-ttf-dev libjpeg-dev libpng-dev libportmidi-dev

And this is what I got:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libpng12-dev' instead of 'libpng-dev'
E: Unable to locate package libsdl2-dev
E: Unable to locate package libsdl2-mixer-dev
E: Unable to locate package libsdl2-image-dev
E: Unable to locate package libsdl2-ttf-dev
E: Unable to locate package libportmidi-dev

Now I have no clue on what to do and how to go about downloading the library. Is there a way I can directly download the library into the sd card image or what. Help me out pls.


1 Answer 1


First do this

sudo apt-get update
sudo apt-get upgrade

Then you try doing

sudo apt-get install python3-pip ?

Then do

sudo pip3 install pygame

If you are still getting the error related to SDL.

Then do this

sudo apt-get install libsdl2-dev
  • $\begingroup$ yeah it says WARNING, No "Setup" File Exists, Running "buildconfig/config.py" Using UNIX configuration... /bin/sh: 1: sdl-config: not found /bin/sh: 1: sdl-config: not found /bin/sh: 1: sdl-config: not found Hunting dependencies... WARNING: "sdl-config" failed! WARNING: "pkg-config freetype2" failed! Unable to run "sdl-config". Please make sure a development version of SDL is installed. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-bdoeu8j1/pygame/' – $\endgroup$ Sep 19, 2019 at 10:48
  • $\begingroup$ and then it said i have to upgrade pip becuz i had it in the sd card apparently and when i did it said Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main $\endgroup$ Sep 19, 2019 at 10:49
  • $\begingroup$ can you please check the version of you python3 by doing this python3 --version $\endgroup$
    – JJerome
    Sep 19, 2019 at 23:29
  • $\begingroup$ Also check the version of pip3 by doing this pip3 --version $\endgroup$
    – JJerome
    Sep 19, 2019 at 23:31
  • $\begingroup$ my python version is python 3.5.2 and for the pip3 version I got pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5) $\endgroup$ Sep 20, 2019 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.