Download and install

There are nightly binary builds available. Those builds are not always as stable as the release, but they contain numerous bugfixes and performance improvements. Note that the OS X nightly builds (but not the release) are slightly miscompiled due to buildslave being old. Contributions are welcomed.

Here are the binaries for the current release — PyPy 2.3.1 — (what's new in PyPy 2.3.1? ) for x86 and ARM Linux, Mac OS/X, Windows and — PyPy3 2.3.1 — (what's new in PyPy3 2.3.1?).

“JIT Compiler” version

These binaries include a Just-in-Time compiler. They only work on x86 CPUs that have the SSE2 instruction set (most of them do, nowadays), or on x86-64 CPUs. They also contain stackless extensions, like greenlets. (This is the official release 2.3.1; for the most up-to-date version see below.)

2.3.1

Note that Linux binaries are dynamically linked, as is usual, and thus might not be usable due to the sad story of linux binary compatibility. This means that Linux binaries are only usable on the distributions written next to them unless you're ready to hack your system by adding symlinks to the libraries it tries to open. In general, we recommend either building from source or downloading your PyPy from your release vendor. Ubuntu (PPA), Debian, Homebrew, MacPorts, Fedora, Gentoo and Arch are known to package PyPy, with various degrees of being up-to-date. You may have more luck trying out Squeaky's portable Linux binaries.

PyPy3 2.3.1

Note that Linux binaries are dynamically linked, as is usual, and thus might not be usable due to the sad story of linux binary compatibility. This means that Linux binaries are only usable on the distributions written next to them unless you're ready to hack your system by adding symlinks to the libraries it tries to open.

If your CPU is really old, it may not have SSE2. In this case, you need to translate yourself with the option --jit-backend=x86-without-sse2.

[1]: stating it again: the Linux binaries are provided for the distributions listed here. If your distribution is not exactly this one, it won't work, likely: pypy: error while loading shared libraries: …. Unless you want to hack a lot, try out the portable Linux binaries.

Other versions

The other versions of PyPy are:

  • The most up-to-date nightly build with a JIT, if the official release is too old for what you want to do. There are versions for different libc on this site too.
  • Sandboxing: A special safe version. Read the docs about sandboxing. (It is also possible to translate a version that includes both sandboxing and the JIT compiler, although as the JIT is relatively complicated, this reduces a bit the level of confidence we can put in the result.) Note that the sandboxed binary needs a full pypy checkout to work. Consult the sandbox docs for details. (These are old, PyPy 1.8.)

Installing

All binary versions are packaged in a tar.bz2 or zip file. When uncompressed, they run in-place. For now you can uncompress them either somewhere in your home directory or, say, in /opt, and if you want, put a symlink from somewhere like /usr/local/bin/pypy to /path/to/pypy-2.3.1/bin/pypy. Do not move or copy the executable pypy outside the tree – put a symlink to it, otherwise it will not find its libraries.

Installing more modules

The recommended way is to install pip, which is the standard package manager of Python. It works like it does on CPython. One practical difference, though, is that it usually comes pre-packaged for you when you get CPython from a place like your Linux distribution. In the case of PyPy (or CPython if you download it from http://www.python.org/), you need to get it separately, as explained in our FAQ.

Installing NumPy

NumPy is an exception to the rule that most packages work without changes. The “numpy” module needs to be installed from our own repository rather than from the official source.

If you have pip (the command-line assumes that it finds the pip belonging to PyPy, not the one from CPython):

pip install git+https://bitbucket.org/pypy/numpy.git

Alternatively, the direct way:

git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install

Note that NumPy support is still a work-in-progress, many things do not work and those that do may not be any faster than NumPy on CPython.

Building from source

  1. Get the source code. The following packages contain the source at the same revision as the above binaries:

    Or you can checkout the current trunk using Mercurial (the trunk usually works and is of course more up-to-date):

    hg clone https://bitbucket.org/pypy/pypy
    
  2. Make sure you installed the dependencies. See the list here.

  3. Enter the goal directory:

    cd pypy/pypy/goal
    
  4. Run the rpython script. Here are the common combinations of options (works also with python instead of pypy):

    pypy ../../rpython/bin/rpython -Ojit targetpypystandalone           # get the JIT version
    pypy ../../rpython/bin/rpython -O2 targetpypystandalone             # get the no-jit version
    pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone   # get the sandbox version
    
  5. Enjoy Mandelbrot :-) It takes on the order of an hour to finish the translation, and 2.x GB of RAM on a 32-bit system and 4.x GB on 64-bit systems. (Do not start a translation on a machine with insufficient RAM! It will just swap forever. See notes below in that case.)

Notes:

  • It is recommended to use PyPy to do translations, instead of using CPython, because it is twice as fast. You should just start by downloading an official release of PyPy (with the JIT). If you really have to use CPython then note that we are talking about CPython 2.5-2.7 here, not CPython 3.x.

  • If RAM usage is a problem (or if you are on Windows, because win32's limit is 2 GB unless you hack a lot), then you can (for now) tweak some parameters via environment variables and command-line options. The following command takes a bit more time, but finishes with only using 3.0 GB of RAM (on Linux 64-bit; probably not much more than 1.6 GB on 32-bit). It should be noted that it is less than with CPython.

    PYPY_GC_MAX_DELTA=200MB pypy --jit loop_longevity=300 ../../rpython/bin/rpython -Ojit targetpypystandalone
    
  • On Linux, because of asmgcroot, compiling the generated C files is delicate. It requires using gcc with no particularly fancy options. It does not work e.g. with clang, or if you pass uncommon options with the CFLAGS environment variable. If you insist on passing these options or using clang, then you can compile PyPy with the shadow stack option instead (for a small performance price in non-JITted code).

Packaging

Once PyPy is translated from source the binary package similar to those provided in the section Default (with a JIT Compiler) above could be easily created with package.py script as following:

cd ./pypy/pypy/tool/release/
python package.py ../../.. pypy-my-own-package-name

Checksums

Here are the checksums for each of the downloads (md5 and sha1):

3237dcf84b03ddaa0d2c7453531d04f0  pypy-2.3.1-linux64.tar.bz2
ac6845dba055e0d962ae744e0ef8cee1  pypy-2.3.1-linux-armhf-raring.tar.bz2
0a96d00edf99d42ac21d46301cffcadb  pypy-2.3.1-linux-armhf-raspbian.tar.bz2
ef9a6e49124c879aa5495c5a2b90ec3c  pypy-2.3.1-linux.tar.bz2
39b8c4c7ae8ff9f7dd8b854834b530ef  pypy-2.3.1-osx64.tar.bz2
aa71e065f89849a9f641cc3ca8d80ebc  pypy-2.3.1-win32.zip
5dab108869a039b754da5c07046fb17c  pypy-2.3.1-linux-armel.tar.bz2
2b9aeccef1587a42fb5a4cc304b5d881  pypy-2.3.1-src.tar.bz2
15c068c357d60719086b23e0bf9d0a5b  pypy-2.3.1-src.zip
a86da5688dfd84e0485239f8991af308  pypy3-2.3.1-linux64.tar.bz2
b0d6a0491e9c9be39d3c314c0823a039  pypy3-2.3.1-linux-armel.tar.bz2
f79f7b5588d2b5a68d2781908bc8f9af  pypy3-2.3.1-linux-armhf-raring.tar.bz2
ac2ffd447db10a05d145a703fb586138  pypy3-2.3.1-linux-armhf-raspbian.tar.bz2
d9003db983452e06bb2a028c9e7b6e2b  pypy3-2.3.1-linux.tar.bz2
a122a2c6414b9d724b46a45f89202578  pypy3-2.3.1-osx64.tar.bz2
4d8d4d1326f40aa98c56ef77439a54aa  pypy3-2.3.1-win32.zip
83731c1cf0b5ecd5acf39210d7710816  pypy3-2.3.1-src.tar.bz2
88f33c7a25996fe4abf342765570a8fe  pypy3-2.3.1-src.zip
2c9f0054f3b93a6473f10be35277825a  pypy-1.8-sandbox-linux64.tar.bz2
009c970b5fa75754ae4c32a5d108a8d4  pypy-1.8-sandbox-linux.tar.bz2
8ef9b71a5fd66bdb598f178602ea195f7c1b0f66  pypy-2.3.1-linux64.tar.bz2
e76fb3b2e11cc6ffe6004377292621b6a38ddcde  pypy-2.3.1-linux-armhf-raring.tar.bz2
31b144d77fd8203d8950b25c8ec8e2a28aed450d  pypy-2.3.1-linux-armhf-raspbian.tar.bz2
18e5bcf259501c99200798f252e5902f29ca2941  pypy-2.3.1-linux.tar.bz2
4d9cdf801e4c8fb432b17be0edf76eb3d9360f40  pypy-2.3.1-osx64.tar.bz2
08639771f26188739a82408454188582c6e25ce9  pypy-2.3.1-win32.zip
ad8ebf67c5ccf354513a9cdb0586080b5964a5bd  pypy-2.3.1-linux-armel.tar.bz2
833b33042456fe381cae4481b2eb536c5787d6c7  pypy-2.3.1-src.tar.bz2
0d3f750fc28713eca77a91388c5a63843406d631  pypy-2.3.1-src.zip
7276a9e97229e754f66863a0793c59066120ec51  pypy3-2.3.1-linux64.tar.bz2
fb52a30be0fd4c7d8686c98e03595a8b48b11e82  pypy3-2.3.1-linux-armel.tar.bz2
0239677fe28a4c22a70853242368456b98ac665a  pypy3-2.3.1-linux-armhf-raring.tar.bz2
c5b8194a63fedcad1441580b183993076e06c06d  pypy3-2.3.1-linux-armhf-raspbian.tar.bz2
90134c8f96f63993a890edbabd905ffb4044829d  pypy3-2.3.1-linux.tar.bz2
263be31beb243aa56e9878b421079e3282617e87  pypy3-2.3.1-osx64.tar.bz2
5f64f8a5d27e185d51c92e5e4717ef977ce12734  pypy3-2.3.1-win32.zip
b9a0d9759f6f383e5c9edab4a21c3b8768f28dbd  pypy3-2.3.1-src.tar.bz2
3c9761c5e7970daf1aaf18feac929c4a0ff0da99  pypy3-2.3.1-src.zip
895aaf7bba5787dd30adda5cc0e0e7fc297c0ca7  pypy-1.8-sandbox-linux64.tar.bz2
be94460bed8b2682880495435c309b6611ae2c31  pypy-1.8-sandbox-linux.tar.bz2