Downloading and Installing PyPy

Using a packaged PyPy

Some Linux distributions provide a pypy package. Note that in order toinstall additional modules that require compilation, you may need to installadditional packages such as pypy-dev. This will manifest as an error about“missing Python.h”. Distributions do not as of yet supply many pypy-readypackages, if you require additional modules we recommend creating a virtualenvand using pip.

Download a pre-built PyPy

The quickest way to start using PyPy is to download a prebuilt binary for yourOS and architecture. You may be able to use either use themost recent release or one of our development nightly build. Thesebuilds depend on dynamically linked libraries that may not be available on yourOS. See the section about Linux binaries for more info and alternatives thatmay work on your system.

Please note that the nightly builds are notguaranteed to be as stable as official releases, use them at your own risk.

Installing PyPy

PyPy is ready to be executed as soon as you unpack the tarball or the zipfile, with no need to install it in any specific location:

  1. $ tar xf pypy-x.y.z.tar.bz2
  2. $ ./pypy-x.y.z/bin/pypy
  3. Python 2.7.x (xxxxxxxxxxxx, Date, Time)
  4. [PyPy x.y.z with GCC x.y.z] on linux2
  5. Type "help", "copyright", "credits" or "license" for more information.
  6. And now for something completely different: ``PyPy is an exciting technology
  7. that lets you to write fast, portable, multi-platform interpreters with less
  8. effort''
  9. >>>>

If you want to make PyPy available system-wide, you can put a symlink to thepypy executable in /usr/local/bin. It is important to put a symlinkand not move the binary there, else PyPy would not be able to find itslibrary.

Installing more modules

If you want to install 3rd party libraries, the most convenient way isto install pip using ensurepip (unless you want to install virtualenv asexplained below; then you can directly use pip inside virtualenvs):

  1. $ ./pypy-xxx/bin/pypy -m ensurepip
  2. $ ./pypy-xxx/bin/pypy -mpip install -U pip wheel # to upgrade to the latest versions
  3. $ ./pypy-xxx/bin/pypy -mpip install pygments # for example

If you wish to be able to use pip directly from the command line, you mustuse the —default-pip argument when calling ensurepip.Third party libraries will be installed in pypy-xxx/site-packages. As withCPython, scripts on linux and macOS will be in pypy-xxx/bin, and on windowsthey will be in pypy-xxx/Scripts

Installing using virtualenv

It is often convenient to run pypy inside a virtualenv. To do thisyou need a version of virtualenv – 1.6.1 or greater. You canthen install PyPy both from a precompiled tarball or from a mercurialcheckout after translation:

  1. # from a tarball
  2. $ virtualenv -p /opt/pypy-xxx/bin/pypy my-pypy-env
  3.  
  4. # from the mercurial checkout
  5. $ virtualenv -p /path/to/pypy/pypy/translator/goal/pypy-c my-pypy-env
  6.  
  7. # in any case activate it
  8. $ source my-pypy-env/bin/activate

Note that my-pypy-env/bin/python is now a symlink to my-pypy-env/bin/pypyso you should be able to run pypy simply by typing:

  1. $ python

You should still upgrade pip and wheel to the latest versions via:

  1. $ my-pypy-env/bin/pypy -mpip install -U pip wheel

Building PyPy yourself

If you’re interested in getting more involved, or doing something different withPyPy, consult the build instructions.