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, and PPC Linux, Mac OS/X and Windows for:

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

* use Squeaky's `portable Linux binaries`_.

Python 3.3.5 compatible PyPy3.3 v5.2

Warning: this is an alpha release supporting the Python 3.3 language. It's also known to be (sometimes much) slower than PyPy 2.

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.
  • 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.4.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 as explained in the installation documentation.

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 using the current developement version of NumPy, since PyPy specific changes have been merged but not in a release version. For example, without using a virtualenv:

$ ./pypy-xxx/bin/pypy -m ensurepip
$ ./pypy-xxx/bin/pip install cython git+https://github.com/numpy/numpy.git

(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 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
    

    The above command may take a long time to run and if it aborts, it is not resumable. You may prefer this way:

    hg clone -r null https://bitbucket.org/pypy/pypy
    cd pypy
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-01.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-02.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-03.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-04.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-05.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-06.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-07.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-08.bz2
    hg unbundle http://buildbot.pypy.org/bundle/pypy-bundle-09.bz2
    hg pull
    hg update
    

    If needed, you can also download the bz2 files by other means. You can then replace the multiple unbundle commands above with a single hg unbundle pypy-bundle-*.bz2.

  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 Python 2.x 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, 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 some 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-26.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.4.1 md5:

425ffedf0db4dd737d450aa064ae0e7a  pypy2-v5.4.1-linux-armel.tar.bz2
15f41409cbadbde3ef22ee60ded8579a  pypy2-v5.4.1-linux-armhf-raring.tar.bz2
5940ea0c1077e3bc2ba461bf55800abb  pypy2-v5.4.1-linux-armhf-raspbian.tar.bz2
23cbad540abff48ea67f5b75368344be  pypy2-v5.4.1-linux32.tar.bz2
2f4a82ae306f3d30d486fb945ca9c6be  pypy2-v5.4.1-linux64.tar.bz2
a18cbd990c97f75a08235a35e546a637  pypy2-v5.4.1-osx64.tar.bz2
90b0650dda1b5bf33f6119f20ba9c3b6  pypy2-v5.4.1-ppc64.tar.bz2
9a2c1b3124151b79e68f36eb2d4891d1  pypy2-v5.4.1-ppc64le.tar.bz2
826d4b48e43c84a50dc7e2adc2cb69d4  pypy2-v5.4.1-s390x.tar.bz2
d1d197d16331aa23a7fd4b5d4c3c1717  pypy2-v5.4.1-src.tar.bz2
1aab9fe6e7c03e959cde466819034bab  pypy2-v5.4.1-src.zip
b04aad943aac92862a73b1fd90157a00  pypy2-v5.4.1-win32.zip

pypy3.3-v5.2-alpha md5:

1176464541dff42e685bf8a9bb393796  pypy3.3-v5.2.0-alpha1-linux32.tar.bz2
dc893175a5cae269017bb89637c3f260  pypy3.3-v5.2.0-alpha1-linux64.tar.bz2
dd741fd946c4d80486a333b89a6fe555  pypy3.3-v5.2.0-alpha1-linux-armel.tar.bz2
c2ff2f04a88415ea10e51e47a3ed19e6  pypy3.3-v5.2.0-alpha1-linux-armhf-raring.tar.bz2
fede8d6612f921967cd91bfbfaa448ea  pypy3.3-v5.2.0-alpha1-linux-armhf-raspbian.tar.bz2
e1cfcd84dab5ded374802231c3e6f9f2  pypy3.3-v5.2.0-alpha1-osx64.tar.bz2
08b9b4dc0ab11fa22f0fc57ba9a62d2b  pypy3.3-v5.2.0-alpha1-s390x.tar.bz2
e4bbd6fe42481a17f705611d76914eda  pypy3.3-v5.2.0-alpha1-src.tar.bz2
49402ad4c853e15e749514649b59220d  pypy3.3-v5.2.0-alpha1-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-5.4.1 sha1:

a54b2a8b6def85663b10fd956d51fbd052954b83  pypy2-v5.4.1-linux-armel.tar.bz2
61c9a5269d6d414c4a1d7c41bbc6a45da318f138  pypy2-v5.4.1-linux-armhf-raring.tar.bz2
ea48ffe40887e25adcf1969a6b0e25dbe42a2457  pypy2-v5.4.1-linux-armhf-raspbian.tar.bz2
bf0ac4668323abead04dd0948a2e541a158e4a00  pypy2-v5.4.1-linux32.tar.bz2
d16601b04987381c4922a19dacb0ca2591a3b566  pypy2-v5.4.1-linux64.tar.bz2
4084b7db8ee16a52e7ecb89d10765d961864c67c  pypy2-v5.4.1-osx64.tar.bz2
98eac6f32f4fe8fce6eb0f0594163f3e01dccced  pypy2-v5.4.1-ppc64.tar.bz2
fc676af00b356ae48602b531675774f2badfc4fd  pypy2-v5.4.1-ppc64le.tar.bz2
70b736f1fdb92ae9916630b7cc8954ed92490f64  pypy2-v5.4.1-s390x.tar.bz2
1143948f50b1b95b55465b246639b4c48251e38e  pypy2-v5.4.1-src.tar.bz2
a6a9ce0defb401d8777d8af5949d23393416a390  pypy2-v5.4.1-src.zip
49c2ad75f1531730f7ee466d833d318333915ce0  pypy2-v5.4.1-win32.zip

pypy3.3-v5.2-alpha sha1:

03c1181f3866b977598e56b4263c8373d3f3a712  pypy3.3-v5.2.0-alpha1-linux32.tar.bz2
ae62d0df060e245b30eb07f12c5bc2260695ac36  pypy3.3-v5.2.0-alpha1-linux64.tar.bz2
cf09edf1232a7bbb475fb19c8e6080d590774c4e  pypy3.3-v5.2.0-alpha1-linux-armel.tar.bz2
3bec09a599371d0aca5408022a9ff4600f801e78  pypy3.3-v5.2.0-alpha1-linux-armhf-raring.tar.bz2
addfd4466e4dead5a4e620214a015a314bfee83e  pypy3.3-v5.2.0-alpha1-linux-armhf-raspbian.tar.bz2
f4a3badfe4c70465e9a2a43fde19e7a92975bc20  pypy3.3-v5.2.0-alpha1-osx64.tar.bz2
eb630112d27063ba336b1d11d083edcda98c3a1f  pypy3.3-v5.2.0-alpha1-s390x.tar.bz2
4b31ab492716ea375dd090bbacdf3d7c2d483059  pypy3.3-v5.2.0-alpha1-src.tar.bz2
d9f5b64f144ebec1a200156809fbbe04fdf7eb7e  pypy3.3-v5.2.0-alpha1-src.zip

pypy2.7-5.4.1 sha256:

a1eb5f672aae62606176305e52a51b060ba974b6181ebefcd2c555ecf5f8614f  pypy2-v5.4.1-linux-armel.tar.bz2
2c4befc4517adec874155a8b6fa0b9d18388943d4ffe778002072db7783e417a  pypy2-v5.4.1-linux-armhf-raring.tar.bz2
b38646519ee1a888c68f8f4713c122867b4b36693c8acabb38eb827a9d2d51f9  pypy2-v5.4.1-linux-armhf-raspbian.tar.bz2
6d1e2386ec1e05dffed493aa2d5e6db5cf5de18d7350d44b85f2e45aa5c9a774  pypy2-v5.4.1-linux32.tar.bz2
9c85319778224d7fb0c348f55fe3fada15bb579c5f3870a13ad63b42a737dd72  pypy2-v5.4.1-linux64.tar.bz2
ae9329c8f0a6df431c6224c27c634f998688ac803e8d100cee9a774e6bba38b5  pypy2-v5.4.1-osx64.tar.bz2
ff118f2dc2393c821595fa7872e4d7bdae2a9a16a854759e103608df383d765a  pypy2-v5.4.1-ppc64.tar.bz2
684e862cdb281a22c95d73012f7d2693be9fd9cdd171784256da1514ae1c8164  pypy2-v5.4.1-ppc64le.tar.bz2
4004c86bf2dfdd1d92120f514d296af7602e0c5e2c6526a14ff8b5508c0fe8f7  pypy2-v5.4.1-s390x.tar.bz2
45dbc50c81498f6f1067201b8fc887074b43b84ee32cc47f15e7db17571e9352  pypy2-v5.4.1-src.tar.bz2
54b23c11a92dd6328a58787c3d719189f0aa24c872b479acf50094dfb4be0a46  pypy2-v5.4.1-src.zip
ec729218a820bc2aa2cf1fcacf9de0fee9e04144fe138596198a6b4615505e03  pypy2-v5.4.1-win32.zip

pypy3.3-v5.2-alpha sha256:

351aec101bdedddae7ea1b63845a5654b1a95fc9393894ef84a66749f6945f17  pypy3.3-v5.2.0-alpha1-linux32.tar.bz2
f5e66ab24267d6ddf662d07c512d06c10ebc732ae62093dabbd775ac63b9060a  pypy3.3-v5.2.0-alpha1-linux64.tar.bz2
ac83e632213f078ab60045e6ad0564b146d65dcd9a52c130026fab6dd85bf2dc  pypy3.3-v5.2.0-alpha1-linux-armel.tar.bz2
b4d847d33c1bf9b3956d1d17b9e37505eb32f68e341c9333a74a82010a63e799  pypy3.3-v5.2.0-alpha1-linux-armhf-raring.tar.bz2
ba9a5d0cbac1c622363315b30df288ab2cf8fcccf7e2882bf5946115dbfa657e  pypy3.3-v5.2.0-alpha1-linux-armhf-raspbian.tar.bz2
abaceab5d2790f49e04e0d80669283da41f94b77cf483b30ac0de48d3c19f304  pypy3.3-v5.2.0-alpha1-osx64.tar.bz2
b0422f4122c214d37d5a2f0f2cc95e3f823bf653e39d742e7de3c8c406c11399  pypy3.3-v5.2.0-alpha1-s390x.tar.bz2
344c2f088c82ea1274964bb0505ab80d3f9e538cc03f91aa109325ddbaa61426  pypy3.3-v5.2.0-alpha1-src.tar.bz2
d31eafa86fa57f70a89ae670e19be08765c0678443a076076eff206160d0594c  pypy3.3-v5.2.0-alpha1-src.zip

pypy-1.8 sandbox sha1:

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