Install and Run Pygame on GameShell with Miniconda

Connect to GameShell via ssh

ssh cpi@

cpi@’s password: [type “cpi”]

Linux clockworkpi …

cpi@clockworkpi:~$ pwd


You can find the address to “ssh" to by navigating to “tiny cloud” in the GameShell. The default username and password are both “cpi”.

Create a folder “downloads” in “/home/cpi/“, where we will place the Miniconda install script later.

mkdir downloads


apps downloads games launcher launchergo music skins

Download Miniconda for Linux and Move to GameShell

I already download the miniconda install script (, which is renamed on the computer and thus I just “scp” it to the GameShell. Alternatively, you can of course download the Anaconda install script directly to the GameShell after “ssh” to it.

cd ~/Downloads

~/Downloads >> scp cpi@

Wait until the transferring/downloading process done.

Install Miniconda on GameShell

Login to GameShell and install Miniconda.

ssh cpi@

cpi@’s password: [type “cpi”]

Linux clockworkpi …

cpi@clockworkpi:~$ bash downloads/

Read the terms and follow the promotions to install Miniconda. Then create the environment, say “first”, install “SDL” ([2]) and “pygame".

cpi@clockworkpi:~$ conda create -n first python=2.7

Install SDL ([2])

cpi@clockworkpi:~$ cd downloads

cpi@clockworkpi:~/downloads$ wget

cpi@clockworkpi:~/downloads$ tar -xzvf SDL-1.2.14.tar.gz

cpi@clockworkpi:~/downloads$ cd SDL-1.2.14

cpi@clockworkpi:~/downloads$ ./configure --prefix=$HOME

cpi@clockworkpi:~/downloads$ make

cpi@clockworkpi:~/downloads$ make install

Install Pygame ([2])

cpi@clockworkpi:~$ source activate first

(first) cpi@clockworkpi:~$ cd downloads

(first) cpi@clockworkpi:~/downloads$ wget

(first) cpi@clockworkpi:~/downloads$ tar -xzvf pygame-1.9.1release.tar.gz

(first) cpi@clockworkpi:~/downloads$ cd pygame-1.9.1release

Comment out the line starting with “_camera” in “Setup”, and then install the “pygame” by running:

(first) cpi@clockworkpi:~/downloads$python install

Now you can import “pygame”.

(first) cpi@clockworkpi:~/downloads$python

Python 2.7.10 …

import pygame

Create a Game and Start in GameShell

Connect to GameShell and navigate into the games. Create a repository “first_game” for the new game.

(first) cpi@clockworkpi:~$ cd games

(first) cpi@clockworkpi:~/games$ mkdir first_game

Create the pygame script “” in “~/games/first_game".

import os, sys, random, time, datetime, math

import pygame

from pygame.locals import *

from pygame.color import *


GS_KEY_X = 117

GS_KEY_Y = 105

GS_KEY_A = 106

GS_KEY_B = 107

GS_KEY_UP = 273






class First :

def __init__(self) :

    self.width = 320

    self.height = 240 = 0.2

    self.event = None

def draw(self, screen) :



    screen.blit(pygame.font.Font(None, 24).render("Hello world!", 1, THECOLORS["black"]), (10, 10))

    screen.blit(pygame.font.Font(None, 24).render("You pressed: %s" % self.event, 1, THECOLORS["black"]), (10, 50))


def run(self) :


    screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)


    clock = pygame.time.Clock()

    running = True

    while running :

        for event in pygame.event.get():

            if event.type == QUIT:

                running = False

            elif event.type == KEYDOWN :

                self.event = event.key

                if event.key == GS_KEY_MENU :

                    running = False



        clock.tick(1 /

if name == “main” :

game = First()

Then create an entrance shell “” in the launcher of GameShell.

(first) cpi@clockworkpi:~$ cd launcher/Menu/GameShell

(first) cpi@clockworkpi:~$ vi

The content of “” should be like this.

#! /bin/bash

source activate first

python ~/games/first_game/

You can also make an icon for the new game, say a png picture “First.png”, and put it into “~/launcher/skin/default/Menu/GameShell”.

Reload the UI, and now you should see a new app named “First” in the launcher. Enter it, you will see “Hello world!” followed by a promotion to tell you the code of the last pressed key. If you followed exactly what are given in “”, then you can exit the first game and back to the launcher by pressing the button “MENU” on the GameShell.

That’s all. Happy coding!






Hello! Thank you for this guide! it’s the only guide that i’ve found on the internet about PyGame on GameShell. But i guess i’m missing some steps in order to run Pygame sample successfully - i get only a black screen for couple of seconds and then i return to main menu.
The first time i’ve tried to follow this guide i’ve missed the line where you need to create first conda environment: conda create -n first python=2.7, but next time i’ve ran it.
Maybe there is some other steps not mentioned in this guide? How should i debug my problem? i’m not expirienced with linux and just wanted to tinker with and with pygame, but stuck right at the beginning :frowning:

UPD: After one more try i get this message while installing PyGame:

Hunting dependencies...
sh: 1: smpeg-config: 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   : not found
PORTMIDI: not found
PORTTIME: not found

Should i install those libs as well?

Hi~It has been a while since I wrote this post, but I think all the steps are recorded, and as I remembered, SDL is the only package you need to handle before installing pygame. Did you install pygame from the source?

yes, i believe i’ve installed PyGame as described in your guide.
i’ve tried to follow your guide one more time and now i get error when trying to call import pygame:

(first)cpi@clockworkpi:~/downloads$ python
Python 2.7.10 |Continuum Analytics, Inc.| (default, Oct 28 2015, 19:48:38)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: and
>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cpi/miniconda/envs/first/lib/python2.7/site-packages/pygame/", line 95, in <module>
    from pygame.base import *
ImportError: /home/cpi/lib/ undefined symbol: _XGetRequest

After a quick search, it seems an old problem due to the incompatible version of other libraries, like libX11. As I can’t repeat this issue on my gameshell, I am not sure in your case which library should be updated. By the way, I repost this guide in a better format [Repost with Snapshot] Install and Run Pygame on GameShell with Miniconda. Hope to hear your problem being solved in the end.

UPDATE: I see someone said this problem appears after update SDL to 1.2.15, which version you used?

The same as in the guide (i’ve copied commands into Putty console)

i’ll try to follow your guide, hope that i’ll able to finish it successfully :slight_smile: