Quick dependency install commands for Ubuntu

You can save tons of time getting other people's games to run if you have the dependencies installed already. Here are Ubuntu commands I used to install a bunch of libraries that might show up in PyWeek:

sudo apt install python python3 python-dev python-pip python-setuptools swig g++ \
  python-pygame python-pyglet libgl1-mesa-dev libglu1-mesa-dev python-opengl \
  python-pyode python-renpy libblas-dev liblapack-dev gfortran pypy python-pil \
  python-yaml python-future python3-future
sudo easy_install -U distribute
pip install --user pymunk cocos2d beautifulsoup rabbyt panda euclid scipy mingus cython \
  kivy pysld2-cffi fysom Pillow

The following are libraries that require the --pre option on pip because of their nonstandard version numbers. Install with care:

pip install --pre --user box2d lepton

You can install pygame for python3 from an unofficial ppa by first becoming root (sudo su -) and then doing the following:

export UBUNTU_VERSION=`lsb_release -cs`
echo deb http://ppa.launchpad.net/thopiekar/pygame/ubuntu $UBUNTU_VERSION main >> /etc/apt/sources.list
echo deb-src http://ppa.launchpad.net/thopiekar/pygame/ubuntu $UBUNTU_VERSION main >> /etc/apt/sources.list
apt update
apt install python3-pygame

The following libraries were on this list at one point, but I can't figure out how to install them anymore. They may be obsolete: pgu, ctypes, libavbin-dev

Do you know of a library not on the list? Tell me its name in pip or whatever and I'll add it.

(log in to comment)


python-pyglet will probably give you version 1.1.4 some people (myself included, although I might be using the latest from the mercurial repo and I'll package it with the game) may be using 1.2alpha1 which is available from PyPI.
It's 1.2alpha1 on Ubuntu 12.04 but I'll go ahead and move it to the pip command, good idea.
If it's pure Python (like pyglet), I think it's probably a good idea to include it with your game so users don't need to install anything besides platform dependent code (like AVbin; that you missed in your list!).
Thanks for the post Cosmo - but perhaps is it worth replacing the "sudo pip" commands with "pip install --user ..." (the simpler solution) or even making a virtualenv first (the better solution)?
Man, I really need to add an "edit comment" button on this damn site.

reidrac: good advice! ship the library version you know works!
I'm not that familiar with pip. My version doesn't list a --user flag on the man page or help. pip does seem to work with it, though. Care to explain what it does? I don't know how to set up a virtualenv, but if you tell me what to put I can try it out then change the comment. :)
I usually run:

virtualenv ENV
source ENV/bin/activate
pip install pip --upgrade

And then pip install whatever I need. Upgrading pip is very important because otherwise you may use an outdated version (may be buggy) that was packaged by your Linux distro, and in my experience using the latest pip is always better.

Finally I never install system-wide with pip because from the point of view of maintainability of the system is not a good idea (may cause problems/conflicts when installing packages with the distro package manater, or upgrading the system to a newer version).

When you're done you can close that terminal session or use "deactivate" to leave the virtualenv.

This is how I do it, and it doesn't mean is "the best way" :)
Setting up a virtualenv is easy if you are using Ubuntu, just run this to set up virtualenvwrapper

apt-get install virtualenvwrapper
echo . /usr/local/bin/virtualenvwrapper.sh >>~/.bashrc
source ~/.bashrc

Then you can create a virtualenv with 'mkvirtualenv' and switch to an existing virtualenv with 'workon'. Check out the docs. You won't look back, promise.
Yeah that's definitely not something I need but that's good to mention for people who want it, thanks. :)
Ok, but tell me you don't mess with sys.path, right?
Right, I don't really have projects with significant dependencies. (For python games I pretty much just use pygame.) I can definitely see it being crucial in a lot of situations. I can't imagine what a pain it would be if you needed two different versions of a library without using virtualenv.
The --user option to pip must have been added recently. It makes pip install packages into the user's python package directory:

With Python 2.6 came the user scheme” for installation, which means that all Python distributions support an alternative install location that is specific to a user. The default location for each OS is explained in the python documentation for the site.USER_BASE variable. This mode of installation can be turned on by specifying the –user option to pip install.