How to install PyPy?

Anyone had any luck getting PyPy running on CL?

sudo swupd search pypy

Bundle with the best search result:
python3-basic - Run Python 3 language programs. (71MB) (installed)

While I have python3-basic installed, it doesn’t appear PyPy is with it.

Looks like there is no ready-to-go package. But you still can compile it by yourself.

This is my steps (tested on newly installed system)

First of all we need install PyEnv to utilize python2 for compilation taks (unfortunately pypy still compiling using v2)


 sudo swupd bundle-add devpkg-ncurses sqlite devpkg-openssl tcl-basic devpkg-readline devpkg-bzip2 devpkg-sqlite-autoconf devpkg-libffi devpkg-xz
 curl -L | bash
 ~/.pyenv/bin/pyenv install 2.7.18
 ~/.pyenv/versions/2.7.18/bin/pip install pycparser

Then, you need to compile Pypy itself. Be careful - during compilation it could consume over 8gb or ram, so check you swap if you below 16gb of ram, otherwise it may crash. Second thing that compilation is depending you hardware is really slow. Usually it takes near 30-60 minutes to finish, so be ready for long wait.


sudo swupd bundle-add mercurial devpkg-expat dev-utils-dev
cd ~/Downloads/ && hg clone
cd pypy && hg update py3.6
cd pypy/goal/
~/.pyenv/versions/2.7.18/bin/python2.7 ../../rpython/bin/rpython --opt=jit
cd ../tool/release/
~/.pyenv/versions/2.7.18/bin/python2.7 --archive-name=pypy
sudo mkdir /opt/pypy && sudo cp -r /tmp/usession-py3.6-$USERNAME/build/pypy/* /opt/pypy
sudo ln -s /opt/pypy/bin/pypy3 /usr/bin/pypy

So now you can run it with “pypy” command.

1 Like