Using Pygame with PyPy

Luka Horvat picture Luka Horvat · Nov 29, 2012 · Viewed 7.3k times · Source

I'm very new to python but I'd like to learn it by making games and pygame seems to be the best option. Since PyPy is the fastest implementation of python (I think) I decided to use that one. But I have no idea how to get those two working together.

I'm on windows.

If anyone would be so kind to give me a step by step on what I need to do I'd be really grateful.

So far, I've installed (extracted to a folder) PyPy, set the pypy.exe as the default for opening .py files, installed Pygame and tried running one of the example .py files. I get the "module pygame not found" error with the first import line in the file.

Answer

mata picture mata · Nov 29, 2012

pygame isn't compatible with pypy, so to use it you'll have to stick with cPython.


Update (April 2018):

As pointed out by in this answer the PyPy v6.0 release now works with pygame - although not yet with the current stable (pygame 1.9.3) release, but with the current developement branch (1.9.4.dev0).

tested on ubuntu 17.10 by:

  • downloading and extracting the latest precompiled version for linux
  • installing the build dependencies for pygame: sudo apt build-dep python-pygame
  • installing pip: ./bin/pypy3 -m ensurepip
  • installing pygame: ./bin/pypy3 -m pip install 'Pygame>=1.9.4.dev0'
  • running the demo: ./bin/pypy3 -m pygame.examples.aliens

Works for both the pypy3 and pypy2 versions.