Ubuntu – How to install pygame and livewires in ubuntu 14.04

14.04python3

This thread is not only about pygame but also about livewires. I followed the first answer on this link but when i write this command : sudo pip install pygame, I get an error saying:

Could not find any downloads that satisfy the requirement pygame.
Some externally hosted files were ignored (use --allow-external pygame to allow).
Cleaning up...
No distributions at all found for pygame
Storing debug log for failure in /home/cooldudeabhi/.pip/pip.log

How to fix them. Also, I am using python 3.4. Please help me to install both modules: Pygame as well as livewires.

Best Answer

Open a terminal and type the following commands. It will install pygame on your system:

sudo apt-get install mercurial python3-pip libfreetype6-dev
sudo apt-get build-dep python-pygame
sudo pip3 install hg+http://bitbucket.org/pygame/pygame

Regarding livewires, it seems that this package is for python2.x only as I got the following error when running sudo pip3 install livewires:

Running setup.py install for livewires
  File "/usr/local/lib/python3.4/dist-packages/livewires/beginners.py", line 201
    raise ExBadParameters, "colour must be from Colour class"
                         ^
SyntaxError: invalid syntax

  File "/usr/local/lib/python3.4/dist-packages/livewires/boards.py", line 239
    if k <> l and k <> -l:
          ^
SyntaxError: invalid syntax

  File "/usr/local/lib/python3.4/dist-packages/livewires/games.py", line 110
    raise GamesError, "Cannot have more than on Screen object"
                    ^
SyntaxError: invalid syntax

Such errors are quite frequent when you want to run python2 code with a python3 interpreter.


Update: it seems possible to run 2to3 on the above files and successfully install livewires.

  1. Download and extract LiveWires-2.1.tar.gz from pypi.
  2. cd LiveWires-2.1
  3. 2to3 -w livewires/*
  4. sudo python3 setup.py install
Related Question