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.

We provide binaries for x86, ARM, PPC and s390x running on different operating systems such as Linux, Mac OS/X and Windows:

  • the Python2.7 compatible release — PyPy2.7 v5.7.0 — (what's new in PyPy2.7?)
  • the Python3.5 compatible beta quality release — PyPy3.5 v5.7.0 — (what's new in PyPy3.5?).
  • the Python2.7 Software Transactional Memory special release — PyPy-STM 2.5.1 (Linux x86-64 only)

“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.

Linux binaries and common distributions

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. There are better solutions:

Python 3.5.3 compatible PyPy3.5 v5.7

Warning: PyPy3.5 is considered beta software. All binaries are thus called “beta”. It is known to be rarely much slower than PyPy 2. You are welcome to use it anyway; if you're lucky it will be fast in your case.

If your CPU is really, really old, it may be a x86-32 without SSE2. There is untested support for manually translating PyPy's JIT without SSE2 (--jit-backend=x86-without-sse2) but note that your machine is probably low-spec enough that running CPython on it is a better idea in the first place.

[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, you will probably see: pypy: error while loading shared libraries: …. Unless you want to hack a lot, try out the portable Linux binaries.

PyPy-STM 2.5.1

This is a special version of PyPy! See the Software Transactional Memory (STM) documentation.

Other versions

The other versions of PyPy are:

  • The most up-to-date nightly binary builds 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.
  • Reverse debugger: This version enables debugging your Python programs by going forward and backward in time. See the RevDB documentation.
  • 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/pypy2-5.7.0/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

There are as yet few distribution-ready packages. We recommend installing pip, which is the standard package manager of Python. It works like it does on CPython as explained in the installation documentation.

If you use your distribution's PyPy package we recommend you install packages into a virtualenv. If you try to build a module and the build process complains about “missing Python.h”, you may need to install the pypy-dev package.

Installing NumPy

There are two different versions of NumPy for PyPy.

1. NumPy via cpyext

The generally recommended way is to install the original NumPy via the CPython C API compatibility layer, cpyext. Modern versions of PyPy support enough of the C API to make this a reasonable choice in many cases. Performance-wise, the speed is mostly the same as CPython's NumPy (it is the same code); the exception is that interactions between the Python side and NumPy objects are mediated through the slower cpyext layer (which hurts a few benchmarks that do a lot of element-by-element array accesses, for example).

Installation works on any recent PyPy (the release above is fine, a recent nightly will implement more of the new buffer protocol). The currently released numpy 1.12 works except for nditers with the updateifcopy flag. For example, without using a virtualenv:

$ ./pypy-xxx/bin/pypy -m ensurepip
$ ./pypy-xxx/bin/pip install cython numpy

(See the general installation documentation for more.)

2. NumPyPy

The “numpy” module can be installed from our own repository rather than from the official source. This version uses internally our built-in _numpypy module. This module is slightly incomplete. Also, its performance is hard to predict exactly. For regular NumPy source code that handles large arrays, it is likely to be slower than the native NumPy with cpyext. It is faster on the kind of code that contains many Python loops doing things on an element-by-element basis.

Installation (see the installation documentation for installing pip):

pypy -m 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

If you installed to a system directory, you need to also run this once:

sudo pypy -c 'import numpy'

Note again that this version is still a work-in-progress: many things do not work and those that do may not be any faster than NumPy on CPython. For further instructions see the pypy/numpy repository.

Building from source

(see more build instructions)

  1. Get the source code. The preferred way is to checkout the current trunk using Mercurial. The trunk usually works and is of course more up-to-date. The following command should run in about 7 minutes nowadays if you have hg >= 3.7 (it is much slower with older versions):

    hg clone https://bitbucket.org/pypy/pypy
    

    Alternatively, the following smaller package contains the source at the same revision as the above binaries:

  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; requires CPython 2.7 or PyPy 2):

    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 half an hour to finish the translation, and about 3GB of RAM on a 32-bit system and about 5GB 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.)

  6. If you want to install this PyPy as root, please read the next section, Packaging.

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.7 here, not CPython 3.x. (Older versions like 2.6 are out.)

  • On some 32-bit systems, the address space limit of 2 or 3 GB of RAM can be an issue. More generally you may be just a little bit low of RAM. First note that 2 GB is really not enough nowadays; on Windows you first need to refer to the Windows build instructions. More precisely, translation on 32-bit takes at this point 2.7 GB if PyPy is used and 2.9 GB if CPython is used. There are two workarounds:

    1. use PyPy, not CPython. If you don't have any PyPy so far, not even an older version, then you need to build one first, with some parts removed. So, first translate with ...rpython -Ojit targetpypystandalone --withoutmod-micronumpy --withoutmod-cpyext, then copy pypy-c and libpypy_c.so somewhere else, and finally call it with ...pypy-c ../../rpython/bin/rpython -Ojit.

    2. if even using PyPy instead of CPython is not enough, try to tweak some internal parameters. Example (slower but saves around 400MB):

    PYPY_DONT_RUN_SUBPROCESS=1 PYPY_GC_MAX_DELTA=200MB pypy --jit loop_longevity=300 ../../rpython/bin/rpython -Ojit --source
    # then read the next point about --source
    
  • You can run translations with --source, which only builds the C source files (and prints at the end where). Then you can cd there and execute make. This is another way to reduce memory usage. Note that afterwards, you have to run manually pypy-c .../pypy/tool/build_cffi_imports.py if you want to be able to import the cffi-based modules.

  • On Linux, translating with asmgcroot, 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 default shadow stack option instead (for a small performance price in non-JITted code).

  • Like other JITs, PyPy doesn't work out of the box on some Linux distributions that trade full POSIX compliance for extra security features. E.g. with PAX, you have to run PyPy with paxctl -cm. This also applies to translation (unless you use CPython to run the translation and you specify --source).

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 --help #for information
python package.py --archive-name pypy-my-own-package-name

It is recommended to use package.py because custom scripts will invariably become out-of-date. If you want to write custom scripts anyway, note an easy-to-miss point: some modules are written with CFFI, and require some compilation. If you install PyPy as root without pre-compiling them, normal users will get errors:

  • PyPy 2.5.1 or earlier: normal users would see permission errors. Installers need to run pypy -c “import gdbm” and other similar commands at install time; the exact list is in package.py. Users seeing a broken installation of PyPy can fix it after-the-fact if they have sudo rights, by running once e.g. sudo pypy -c "import gdbm.
  • PyPy 2.6 and later: anyone would get ImportError: no module named _gdbm_cffi. Installers need to run pypy _gdbm_build.py in the lib_pypy directory during the installation process (plus others; see the exact list in package.py). Users seeing a broken installation of PyPy can fix it after-the-fact, by running pypy /path/to/lib_pypy/_gdbm_build.py. This command produces a file called _gdbm_cffi.pypy-41.so locally, which is a C extension module for PyPy. You can move it at any place where modules are normally found: e.g. in your project's main directory, or in a directory that you add to the env var PYTHONPATH.

Checksums

Here are the checksums for each of the downloads

pypy2.7-v5.7.0 md5:

bb55f4a28d64d40367a58139b25b02fe  pypy2-v5.7.0-linux32.tar.bz2
84b542e3aaca2aec9b0ca3afb6a3373b  pypy2-v5.7.0-linux64.tar.bz2
9f98c917ec1dbbda821bd23734fdc4d4  pypy2-v5.7.0-linux-armel.tar.bz2
509539d3f5876584fa5cad6fd125e446  pypy2-v5.7.0-linux-armhf-raring.tar.bz2
34739358ba2e438d27b777838154f255  pypy2-v5.7.0-linux-armhf-raspbian.tar.bz2
6b6180f4b0932d5a3a7499ddef1c5129  pypy2-v5.7.0-osx64.tar.bz2
180d5cc3f58a9f9088481c7d4c6b5d68  pypy2-v5.7.0-s390x.tar.bz2
aa26e72c1f30b77734198af6fb6f9ad7  pypy2-v5.7.0-src.tar.bz2
f1633ad18e0af309aa11e3425f628cf9  pypy2-v5.7.0-src.zip
23f15d2bc0c29fe6948a99352962ebf0  pypy2-v5.7.0-win32.zip

pypy 3.5-v5.7.0 md5:

410fb506ac436c344f785bb77820e13e  pypy3-v5.7.0-linux64.tar.bz2
79b1d5749eb97be36933dbdf156fec02  pypy3-v5.7.0-src.tar.bz2
594f3d17be1c80181d13c0f025ae25f6  pypy3-v5.7.0-src.zip

pypy3.3-v5.5.0-alpha md5:

e9bdfb330a30765eaf76ddd4e826a45e  pypy3.3-v5.5.0-alpha-linux32.tar.bz2
b04022a5a549bba719c9a184c783805c  pypy3.3-v5.5.0-alpha-linux64.tar.bz2
84424f01b2746c71f64e27cb4c7069a1  pypy3.3-v5.5.0-alpha-linux-armel.tar.bz2
9d18b171a7249227f3a3b74af8070c82  pypy3.3-v5.5.0-alpha-linux-armhf-raspbian.tar.bz2
d2424a9e3ff31e26e5b1f0ceade5e9f7  pypy3.3-v5.5.0-alpha-osx64.tar.bz2
c32728185d89f9c0fda9481f2f9ae61d  pypy3.3-v5.5.0-alpha-s390x.tar.bz2
536008fd7b17af8878915393fc1ecfc3  pypy3.3-v5.5.0-alpha-src.tar.bz2
4fc66068848dbfc09b210d3115380b0a  pypy3.3-v5.5.0-alpha-src.zip

pypy-1.8 sandbox md5:

2c9f0054f3b93a6473f10be35277825a  pypy-1.8-sandbox-linux64.tar.bz2
009c970b5fa75754ae4c32a5d108a8d4  pypy-1.8-sandbox-linux.tar.bz2

pypy2.7-v5.7.0 sha1:

c8cc2cbc2b75962d0e5920f4a756f7fe3f13596c  pypy2-v5.7.0-linux32.tar.bz2
0a831dae298fce2110626637342d0e3545a8ab47  pypy2-v5.7.0-linux64.tar.bz2
556face1374a75720177176a4c7517bb4f9a62a5  pypy2-v5.7.0-linux-armel.tar.bz2
bec04d53cd2a7cc89cf67cfdab2207ad6c08781b  pypy2-v5.7.0-linux-armhf-raring.tar.bz2
c510f53447fc800b4611545d2679d596d8f0c461  pypy2-v5.7.0-linux-armhf-raspbian.tar.bz2
097e418d5aa61c7697a50536c5b173d8211603a9  pypy2-v5.7.0-osx64.tar.bz2
a11cf7d95a909c8e60bafc79ff491711ecd0ee29  pypy2-v5.7.0-ppc64.tar.bz2
0ccb73316935c5610e5170330556443abd87d3cd  pypy2-v5.7.0-ppc64le.tar.bz2
20f33a4d0c08a5d4935086caec73be3d92b60b2b  pypy2-v5.7.0-s390x.tar.bz2
5976e1f19a42f64f778d385322723200b5c6d7c9  pypy2-v5.7.0-src.tar.bz2
c84ad90184edb315031074696e805ecbc08494e3  pypy2-v5.7.0-src.zip
15df479b08870dc6ec9cab0e4587935fc0694cb8  pypy2-v5.7.0-win32.zip

pypy 3.5-v5.7.0 sha1:

e10511bde5a88c5de9fdf9234188b8df23382a6a  pypy3-v5.7.0-linux64.tar.bz2
0b12230025d77be26bc10cbc81671c4b3719528c  pypy3-v5.7.0-src.tar.bz2
ae256d83173faaadce9602594fd752fb664b813b  pypy3-v5.7.0-src.zip

pypy3.3-v5.5.0-alpha sha1:

1de17b61b8d21e408a46114961659b4c0f15cb54  pypy3.3-v5.5.0-alpha-linux32.tar.bz2
995ae3b983d9975006b898f098b27408949d2fdf  pypy3.3-v5.5.0-alpha-linux64.tar.bz2
2487f726d7b50aef041beba2bb0f39fe4d7392da  pypy3.3-v5.5.0-alpha-linux-armel.tar.bz2
ed104a504664a7ccd971da202abe14302246175a  pypy3.3-v5.5.0-alpha-linux-armhf-raspbian.tar.bz2
0f6456672b02e4856421021d2ff71ffaca2e2c3e  pypy3.3-v5.5.0-alpha-osx64.tar.bz2
018e9e9e4c54fcef3959bc316f3e684f88231ab4  pypy3.3-v5.5.0-alpha-s390x.tar.bz2
9eb6aad2d41f7db16c19ae6e438c8f195b0d44fc  pypy3.3-v5.5.0-alpha-src.tar.bz2
b670cdc685c323b11bfdca2a15f12c5953e6d8b4  pypy3.3-v5.5.0-alpha-src.zip

pypy2.7-v5.7.0 sha256:

aaa55085d11a49cb982b059b4159495d7a4fb9afcfda7bfd680cc0175e9fa33b  pypy2-v5.7.0-linux32.tar.bz2
64bed80e299b09c13296f577a0f52c5d4be9f7c699a390ca6026f967aeff3846  pypy2-v5.7.0-linux64.tar.bz2
3bc0d2616cacef9f544e739d4c25a89e16d7aa8c1ccb18c32dceeb021ed73711  pypy2-v5.7.0-linux-armel.tar.bz2
413df8097c87a8e79cc46df65837b1d533de83b7cb06ce88b168697807fff696  pypy2-v5.7.0-linux-armhf-raring.tar.bz2
6328e4767cf20d20a290739db2d1ec769f3c9c360fa9824f61581b3356add79b  pypy2-v5.7.0-linux-armhf-raspbian.tar.bz2
9204aa1b55771a374a3118bb43e498c88caca8c33710eecf3249855c4dd1352a  pypy2-v5.7.0-osx64.tar.bz2
ca936b034a5cd2decfd3b500fad3c28e5a6327a77bb56b2d2ba6ff0159c00f2c  pypy2-v5.7.0-ppc64.tar.bz2
3ecb3165c85df60f8e59bfdf28304cd40894d304ee04a4d58dc8b9947cbb2b01  pypy2-v5.7.0-ppc64le.tar.bz2
8820b36f38b4aa44c1ef2be213c7d13818c9fdb61795f24f4fb18a7a78d2dde7  pypy2-v5.7.0-s390x.tar.bz2
e522ea7ca51b16ee5505f22b86803664b762a263a6d69ba84c359fcf8365ad3e  pypy2-v5.7.0-src.tar.bz2
784be3d2b8bb12a0d88d088fd991b03324d9f84a48af5dbaf2a536eaee91d8b5  pypy2-v5.7.0-src.zip
09c8da3a7e09cea821f9b300c6f4f52f4a571d949d91839ecbce93b84a08d570  pypy2-v5.7.0-win32.zip

pypy 3.5-v5.7.0 sha256:

921894884a647220a712ecdaad516d9c22fbadf3b4bb3a5db8f3635c60eabc7b  pypy3-v5.7.0-linux64.tar.bz2
f0f563b74f8b82ec33b022393219b93cc0d81e9f9500614fe8417b67a52e9569  pypy3-v5.7.0-src.tar.bz2
fe8b9804a8599ef5b16114fb64ba8392342f0066dfe81103b89198a3c5d10989  pypy3-v5.7.0-src.zip

pypy3.3-v5.5.0-alpha sha256:

966ee7951ad497ac907e01554fe48da77cc64a5e35a1307477c2f78652eba622  pypy3.3-v5.5.0-alpha-linux32.tar.bz2
41ef7c25fd04eeb20deaa83c5d88c10aef2bbc8bcfd9e53e7cc61136220861cc  pypy3.3-v5.5.0-alpha-linux64.tar.bz2
9f081041867f434f18456f936befbacd9f40c0ede24137cbf80f9f45ff37b69f  pypy3.3-v5.5.0-alpha-linux-armel.tar.bz2
d8e94c834307081d5c4be863fab935e34df360a77b06e8bc833624c4b712b2aa  pypy3.3-v5.5.0-alpha-linux-armhf-raspbian.tar.bz2
fa45f861a6c40ae44f99ec94c521adfb6b64b0c9c0b6fc6e9df018241a648986  pypy3.3-v5.5.0-alpha-osx64.tar.bz2
c4a0a75a987b3dacd811c653e57b6a0a01fc31cdaf671e83ad43f4c107961a02  pypy3.3-v5.5.0-alpha-s390x.tar.bz2
d5591c34d77253e9ed57d182b6f49585b95f7c09c3e121f0e8630e5a7e75ab5f  pypy3.3-v5.5.0-alpha-src.tar.bz2
43b3791f77f253d4da59fdeeec49b1daefea9a57321c726a19b4924c520a0b49  pypy3.3-v5.5.0-alpha-src.zip

pypy-1.8 sandbox sha1:

895aaf7bba5787dd30adda5cc0e0e7fc297c0ca7  pypy-1.8-sandbox-linux64.tar.bz2
be94460bed8b2682880495435c309b6611ae2c31  pypy-1.8-sandbox-linux.tar.bz2