Download and install
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 v6.0 — (what's new in PyPy2.7?)
- the Python3.5 compatible release — PyPy3.5 v6.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:
Python2.7 compatible PyPy 6.0.0
Python 3.5.3 compatible PyPy3.5 v6.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.
: 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.
This is a special version of PyPy! See the Software Transactional Memory (STM) documentation.
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).
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.
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). The currently released numpy 1.13 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.)
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)
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:
Make sure you installed the dependencies. See the list here.
Enter the goal directory:
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
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.)
If you want to install this PyPy as root, please read the next section, Packaging.
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).
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.
Here are the checksums for each of the downloads
ee1980467ac8cc9fa9d609f7da93c5282503e59a548781248fe1914a7199d540 pypy2-v5.10.0-linux32.tar.bz2 da85af9240220179493ad66c857934dc7ea91aef8f168cd293a2d99af8346ee2 pypy2-v5.10.0-linux64.tar.bz2 6fdd55dd8f674efd06f76edb60a09a03b9b04a5fbc56741f416a94a0b9d2ff91 pypy2-v5.10.0-linux-armel.tar.bz2 5ec3617bb9a07a0a0b2f3c8fbe69912345da4696cdb0a2aca7889b6f1e74435c pypy2-v5.10.0-linux-armhf-raspbian.tar.bz2 7e4120f0a83529a6851cbae0ec107dc7085ba8a4aeff4e7bd9da9aadb1ef37a4 pypy2-v5.10.0-osx64.tar.bz2 dab4dccfa71820c4f803f5a82e13f76517bfde5fafe1e5fba6ff58ef2ba318ab pypy2-v5.10.0-s390x.tar.bz2 1209f2db718e6afda17528baa5138177a14a0938588a7d3e1b7c722c483079a8 pypy2-v5.10.0-src.tar.bz2 89304eb886f84b5c65f3f4079445ef018cdb9a6e59ef4ed2095d37248a3fefcc pypy2-v5.10.0-src.zip 350914f9b70404781674f2f188f84d440d9d25da46ed9733b3f98269a510e033 pypy2-v5.10.0-win32.zip 9afa1a36a5fc55ebc3e80576f05f44294f2b0de279862286fe00f5ee139965b1 pypy2-v5.10.0-ppc64.tar.bz2 2c32ccfa80e3e2ec56b4cc848526046d7b0de1f2f1a92b0cedeb414ec76745ab pypy2-v5.10.0-ppc64le.tar.bz2
ad1082d4328ae8f32617b14628648583b82b6d29df3aa42b97bd1853c08c4bc8 pypy2-v6.0.0-linux32.tar.bz2 6cbf942ba7c90f504d8d6a2e45d4244e3bf146c8722d64e9410b85eac6b5af67 pypy2-v6.0.0-linux64.tar.bz2 924ca3f90aa28e8961859508c25752c95253b842318a0f267267ffe90f56a916 pypy2-v6.0.0-linux-armel.tar.bz2 6506ce739e31981e5596d3cc2e2c7f5b086ee77bb4d97773082b62b2f283eef2 pypy2-v6.0.0-linux-armhf-raspbian.tar.bz2 d7dc443e6bb9a45212e8d8f5a63e9f6ce23f1d88c50709efea1c75b76c8bc186 pypy2-v6.0.0-osx64.tar.bz2 bf155c8ac2f757d24361591080a9f4f95424a07e30f943f7d751d96442e0f36a pypy2-v6.0.0-s390x.tar.bz2 6097ec5ee23d0d34d8cd27a1072bed041c8a080ad48731190a03a2223029212d pypy2-v6.0.0-src.tar.bz2 3553b19447cdb627919cc37d76979e15dc755b085e979f5ffa9b25933ec343b3 pypy2-v6.0.0-src.zip 6e2210dae1ae721ed4eb9cba19f15453514b64111511c84f24843c4fdefdaf7f pypy2-v6.0.0-win32.zip
pypy 3.5-v5.10.0 sha256:
pypy 3.5-v5.10.1 sha256:
a6ceca9ee5dc511de7902164464b88311fec9366c5673d0c00528eda862bbe54 pypy3-v5.10.1-linux32.tar.bz2 75a276e1ee1863967bbacb70c5bff636de200768c0ec90e72f7ec17aace0aefe pypy3-v5.10.1-linux64.tar.bz2 5065e9ad958d06b9612ba974f43997d20168d4245c054dd43270e4b458782282 pypy3-v5.10.1-linux-armel.tar.bz2 203dd595fbad7055340b23326f20c85b0d6c11c4877e3559a437611fc2ac40c2 pypy3-v5.10.1-linux-armhf-raspbian.tar.bz2 52f006611513c995fdebba6e72d394186d4085460408cbbe086e5467bf3fb9b6 pypy3-v5.10.1-osx64.tar.bz2 f5548e06e2fc0c24ec8b6e3c5b09f90081818f7caa3e436dc312592611724713 pypy3-v5.10.1-src.tar.bz2 182378d7aab395ee6cf539fb011ec0e384624282834aaaed4a663972a5aa8797 pypy3-v5.10.1-src.zip 4edf4f021689a529e5a631c5cca72a1a9dc19a6ea2091e64289cdd5b60eaf929 pypy3-v5.10.1-win32.zip 9ce98481cddede40a3357f7462f2c894bb96f178e2e8715d04feda1476ec1563 pypy3-v5.10.1-s390x.tar.bz2
pypy 3.5-v6.0.0 sha256:
b04eeee5160e6cb5f8962de80f077ea1dc7be34e77d74bf075519c23603f5ff9 pypy3-v6.0.0-linux32.tar.bz2 4cfffa292b9ef34bb6ba39cdbaa196c5c5cbbc5aa3faaa157cf45d7e34027048 pypy3-v6.0.0-linux64.tar.bz2 6a6888a55192f58594838b8b3d2e7daaad43d3bf4293afab3dd8987d0bbd1124 pypy3-v6.0.0-linux-armel.tar.bz2 8a0420dda23413925400538bbfc0cff2bbb2ab0de984eef6faaeab6d3309cbcc pypy3-v6.0.0-linux-armhf-raspbian.tar.bz2 938b8034e30f5f5060d2a079070c56c3be5559bc7ae9cc0c8395fe6fc45cfe4c pypy3-v6.0.0-osx64.tar.bz2 f0a3097cf74d6b1fb3ae2a060384e72b7868ca76cd04584336b417e9982ec0a5 pypy3-v6.0.0-s390x.tar.bz2 ed8005202b46d6fc6831df1d13a4613bc40084bfa42f275068edadf8954034a3 pypy3-v6.0.0-src.tar.bz2 8cd3cc2ef362e774edf9c7a6b79dbe42fff75217c5ed96b235a0a792e4421dc4 pypy3-v6.0.0-src.zip 72dddb3746a51f7672c77d619c818e27efe899e08ae82762448e50dbfdc2f5f3 pypy3-v6.0.0-win32.zip