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 (what's new in PyPy 7.1.1?):

  • the Python2.7 compatible release — PyPy2.7 v7.1.1
  • the Python3.6 compatible release, beta quality — PyPy3.6 v7.1.1
  • the (older) Python3.5 compatible release — PyPy3.5 v7.0
  • 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:

Python2.7 compatible PyPy 7.1.1

Python 3.6 compatible PyPy3.6 v7.1.1-beta

Python 3.5.3 compatible PyPy3.5 v7.0.0

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. This version is not supported and not actively maintained. You will likely have to fix some issues yourself, or checkout an old version, or otherwise play around on your own. We provide this documentation only for historical reasons. Please do not use in production. For reference, there are some very old, unmaintained binaries for Linux (32bit, 64bit).

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_expanded/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. For details see this FAQ question.

1. Standard NumPy

Installation works on any recent PyPy (the release above is fine). 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 also be installed from our own repository rather than from the official source. This version uses our built-in _numpypy multiarray replacement module, written in RPython. This module is not complete, but if it works it should give correct answers. Its performance is hard to predict exactly. For regular NumPy source code that handles large arrays, it is likely to be slower than the standard NumPy. It is faster on pure python code that loop over ndarrays 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 incomplete: 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 and the FAQ question about the difference between the two.

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
    

    The trunk contains PyPy 2. For PyPy 3, switch to the correct branch:

    # for PyPy 3: switch to the branch of PyPy that implements Python 3.5
    hg update py3.5
    

    Alternatively, get one of the following smaller packages for 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, even to build PyPy 3):

    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 of PyPy 7.1.1, 7.1.0, 7.0.0

pypy2.7-7.1.1 sha256:

41ca390a76ca0d47b8353a0d6a20d5aab5fad8b0bb647b960d8c33e873d18ef5  pypy2.7-v7.1.1-linux32.tar.bz2
73b09ef0860eb9ad7997af3030b22909806a273d90786d78420926df53279d66  pypy2.7-v7.1.1-linux64.tar.bz2
31a17294dec96c2191885c776b4ee02112957dc874f7ba03e570537a77b78c35  pypy2.7-v7.1.1-osx64.tar.bz2
1ef94c3a9c67c2335cee0b21753036b4696ed588b9d54b7b8036a6ae47f7001d  pypy2.7-v7.1.1-s390x.tar.bz2
5f06bede6d71dce8dfbfe797aab26c8e35cb990e16b826914652dc093ad74451  pypy2.7-v7.1.1-src.tar.bz2
d9b07a2954ad6dbde94feffd848311e2b5169563d33e3e9f17969579b01a4158  pypy2.7-v7.1.1-src.zip
9c59226311f216a181e70ee7b5aa4d9665a15d00f24ae02acec9af7d96355f63  pypy2.7-v7.1.1-win32.zip

pypy2.7-7.1.0 sha256:

44ec91e8cb01caab289d8763c203f3aaf288d14325a6c42692bd1ac4e870d758  pypy2.7-v7.1.0-linux32.tar.bz2
fef176a29a2ef068c00c8098e59dab935ca6e956f089672b3f7351da95a034f5  pypy2.7-v7.1.0-linux64.tar.bz2
8be43685ce718b0768387450fc6dc395d60809b778b6146c353ef67826022153  pypy2.7-v7.1.0-osx64.tar.bz2
b065f55741bcb37863f1eca30ce91c9d79159371a6994100930cdc2ede3237bc  pypy2.7-v7.1.0-s390x.tar.bz2
b051a71ea5b4fa27d0a744b28e6054661adfce8904dcc82500716b5edff5ce4b  pypy2.7-v7.1.0-src.tar.bz2
e60ce30f9947844da43daaa7658adc0c05330681305225954114772f42df06ec  pypy2.7-v7.1.0-src.zip
76658c9ad679d562b8b6a09d006caa666406337b9834ff56db16980c5e549f20  pypy2.7-v7.1.0-win32.zip

pypy3.6-7.1.1 sha256:

cb11ef4b0df569c28390b1ee93029159e1b90bfbad98df6abd629d5203b2abd9  pypy3.6-v7.1.1-linux32.tar.bz2
8014f63b1a34b155548852c7bf73aab2d41ebddf2c8fb603dc9dd8509be93db0  pypy3.6-v7.1.1-linux64.tar.bz2
a5c2f2bfa2b4a4d29e8a67baab95699b169054066df218a14f171bb84a6df0c0  pypy3.6-v7.1.1-osx64.tar.bz2
4a91bf2d9a142b6dbf82b5301cb510535ae9a54e1645546b2e0735a7b5ed85ba  pypy3.6-v7.1.1-s390x.tar.bz2
6a3ef876e3691a54f4cff045028ec3be94ab9beb2e99f051b83175302c1899a8  pypy3.6-v7.1.1-src.tar.bz2
4a3ebeb767740f2dc0b886d02797d21d7d69f154cf951bb991c19bd485e6cae1  pypy3.6-v7.1.1-src.zip
8b513b254de5f31890f5956569de9aec3a0a91d7aba72fc89d66901f4a8ccf49  pypy3.6-v7.1.1-win32.zip

pypy 3.6-v7.1.0 sha256:

031bfac61210a6e161bace0691b854dc15d01b0e624dc0588c544ee5e1621a83  pypy3.6-v7.1.0-linux32.tar.bz2
270dd06633cf03337e6f815d7235e790e90dabba6f4b6345c9745121006925fc  pypy3.6-v7.1.0-linux64.tar.bz2
d46e005ba095cb4a7006079ffbf4fe63c18cf5e9d8ce9ce8383efc1a4863ab5b  pypy3.6-v7.1.0-osx64.tar.bz2
243cd0cc188a94c1f064f402ae72b8ba4303eb3137eac53c53826472b8005098  pypy3.6-v7.1.0-s390x.tar.bz2
faa81f469bb2a7cbd22c64f22d4b4ddc5a1f7c798d43b7919b629b932f9b1c6f  pypy3.6-v7.1.0-src.tar.bz2
4858e7e8a0007bc3b381bd392208b28d30889a4e5a88a3c28e3d9dc4f25b654e  pypy3.6-v7.1.0-src.zip
77a0576a3d518210467f0df2d0d9a1892c664566dc02f25d974c2dbc6b4749e7  pypy3.6-v7.1.0-win32.zip

pypy2.7-7.0.0 sha256:

446fc208dd77a0048368da830564e6e4180bcd786e524b5369c61785af5c903a  pypy2.7-v7.0.0-linux32.tar.bz2
971b1909f9fe960c4c643a6940d3f8a60d9a7a2937119535ab0cfaf83498ecd7  pypy2.7-v7.0.0-linux64.tar.bz2
e7ecb029d9c7a59388838fc4820a50a2f5bee6536010031060e3dfa882730dc8  pypy2.7-v7.0.0-osx64.tar.bz2
2ce390d93fa57ba912066a8b6439588bd9cf6aa9cef44d892b8e3e6dba64615e  pypy2.7-v7.0.0-s390x.tar.bz2
04477a41194240cd71e485c3f41dec35a787d1b3bc030f9aa59e5e81bcf4118b  pypy2.7-v7.0.0-win32.zip
165ffdf49a04c3ebdc966f76e67dd1767ad699657215dd83ca6996ab8ed87f52  pypy2.7-v7.0.0-ppc64.tar.bz2
cfb0e2e9b1434e94ea559548c7486c8e7b4319a397309e8ed3783d9beadf1c6c  pypy2.7-v7.0.0-ppc64le.tar.bz2
f51d8bbfc4e73a8a01820b7871a45d13c59f1399822cdf8a19388c69eb20c18c  pypy2.7-v7.0.0-src.tar.bz2
77c8c02cf412a5f8182ffe8845877cffa506e5a5ce3a7cd835483fdc1202afd4  pypy2.7-v7.0.0-src.zip

pypy 3.5-v7.0.0 sha256:

b8db8fbca9621de8ea8cd7184b322f2dddb2f385e8e5a63dfb75bb3fea4b2e3f  pypy3.5-v7.0.0-linux32.tar.bz2
729e3c54325969c98bd3658c6342b9f5987b96bad1d6def04250a08401b54c4b  pypy3.5-v7.0.0-linux64.tar.bz2
7c6d71653d9b1a7946d1eeebbf24b454fe934fba8b0c39f648bdc545fb2895ce  pypy3.5-v7.0.0-osx64.tar.bz2
d588b045cc0d3a75c31fce54c1d181b1206ad9a5dd272fe79160a6268401605f  pypy3.5-v7.0.0-s390x.tar.bz2
23e30b00ab61f24578059e4643fbf0221982faffd874898b5737fc5b334ca0ab  pypy3.5-v7.0.0-ppc64.tar.bz2
2912884da05abc2cdf71dd337c3f280095351312c1a1732a52b6878174a0fd02  pypy3.5-v7.0.0-ppc64le.tar.bz2
TODO win32
b2ddb0f45cb4e0384fb498ef7fcca2ac96c730b9000affcf8d730169397f017f  pypy3.5-v7.0.0-src.tar.bz2
3aa3a921c163667761165dbd2070e56d6715979fe9cc1f135d58ea0692a05a1e  pypy3.5-v7.0.0-src.zip