20

I want to install pypy3 in Ubuntu. I have read the answer for this question "How to install PyPy3 (2.1, beta) on Ubuntu?" and still have no idea what to do. Could some kind soul please explain it so that even I can understand it :)

Here's what I have done so far:

Went here

Read that I had to go here

Downloaded: pypy3-2.1-beta-linux_x86_64-portable.tar.bz2

Opened it with the Archive manager (because it seemed like a reasonable thing to do)

Extracted it to desktop/PYPY3

Then desperately tried all the shell commands I came across last night. I will not be able to give a clear account of what I tried and what errors came back, as it is kind of a blur to me at this point.

But I can tell you that I got the Tar thing unpacked at one point and that I have tried running the pypy executable from the command line from the folder containing it, but got this:

bash: /usr/bin/pypy: No such file or directory

Could someone please tell me what to do. (have read the readme, the install docs at pypy.org and lots of posts)

5
  • 1
    Did you have a look at this: askubuntu.com/questions/360187/…?
    – jobin
    Apr 1, 2014 at 14:58
  • yes, and I tried to follow the instructions, spent hours on it actually. What was hoping for was a dumbed down version I could follow. Apr 1, 2014 at 15:03
  • The answer to that question seems pretty simple, what in it could you not digest- list it explicity?
    – jobin
    Apr 1, 2014 at 15:09
  • I've just re read the question again. He says he is able to run the pypy binary through the terminal. I'm not that far yet. Therefore the rest of the answer is not directly aplicable to me. in the readme of the download it says to run this line rpython/bin/rpython -Ojit pypy/goal/targetpypystandalone.py to install pypy, this gives me a No such file or directory error. I think this is what I need to get working Apr 1, 2014 at 15:27
  • I have a similar problem. I've downloaded it into $HOME, extracted via tar went into pypy3-v5.10.1-linux64/bin and tried to run pypy3, which is in this folder, but bash tells me No command 'pypy3' found
    – sunwarr10r
    Feb 7, 2018 at 14:37

5 Answers 5

28

All the answers here are either outdated or unnecessarily complicated.

sudo add-apt-repository ppa:pypy/ppa
sudo apt update
sudo apt install pypy3

As simple as that!

See https://launchpad.net/~pypy/+archive/ubuntu/ppa for details.

2
  • The other answers (mine included) are evidently outdated. pypy3 was not in the pypy PPA last year when I was looking into this. May 15, 2019 at 20:58
  • 1
    Unfortunately, this distribution is a pain in the ass. It uses system site-packages and pypy3 -m ensurepip will not work. I suggest to use the tar distribution the first moment you experience any trouble. Apr 16, 2020 at 21:11
5

This is a portable version of PyPy. It is not installed system wide. You use it like this. After downloading a file lets say to your Downloads folder open your terminal window and run this:

cd ~/Downloads
tar xf pypy3-2.1-beta-linux_x86_64-portable.tar.bz2
pypy3-2.1-beta-linux_x86_64-portable/bin/pypy

You will get PyPy prompt.

Note that PyPy 3 is not fully done. This is preview version that is inteded for testing.

1
  • This answer works perfectly. Much appreciated. Apr 16, 2014 at 14:06
3

Here's installing section of download page from PyPy's website:

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.10.0/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.

In can be expressed like (excerpt from snake-tank Docker image):

wget -q -P /tmp \
  https://bitbucket.org/pypy/pypy/downloads/pypy3-v5.10.1-linux64.tar.bz2 
sudo tar -x -C /opt -f /tmp/pypy3-v5.10.1-linux64.tar.bz2
rm /tmp/pypy3-v5.10.1-linux64.tar.bz2
sudo mv /opt/pypy3-v5.10.1-linux64 /opt/pypy3
sudo ln -s /opt/pypy3/bin/pypy3 /usr/local/bin/pypy3

After that you can create virtual environments as usual:

virtualenv -p pypy3 some_env
3

Or with snap:

sudo snap install pypy3 --classic
1

See Bora M. Alper's answer to easily install the PyPy 3 package from a PPA.


You can build PyPy 3 from source by doing the following as documented on the PyPy download and build pages.

You can either download the source code archive pypy3-v6.0.0-src.tar.bz2 with the browser or your favorite download utility:

wget https://bitbucket.org/pypy/pypy/downloads/pypy3-v6.0.0-src.tar.bz2
tar -xjf pypy3-v6.0.0-src.tar.bz2
cd pypy3-v6.0.0-src

Or you can download it from the Mercurial repository and switch to the 3.5 branch:

hg clone https://bitbucket.org/pypy/pypy
cd pypy
hg update py3.5

PyPy recommends that you build it using PyPy 2 because it'll be faster than using CPython 2.7. Ensure PyPy 2 is installed:

sudo apt-get install pypy

Now install the build dependencies:

sudo apt-get install gcc make libffi-dev pkg-config zlib1g-dev libbz2-dev libsqlite3-dev libexpat1-dev libssl-dev libgdbm-dev tk-dev libgc-dev python-cffi liblzma-dev libncursesw5-dev

Run the translation (compilation):

cd pypy/goal # pypy3-v6.0.0-src/pypy/goal
pypy ../../rpython/bin/rpython -Ojit targetpypystandalone

Even though the shell might not tab-complete ../../rpython/bin/rpython, it's there. The download guide says it requires 5 GB of RAM and takes about 30 minutes to run. It took 32 minutes on my 4th generation i7.

Package PyPy so that it can be installed:

cd ../tool/release # pypy3-v6.0.0-src/pypy/tool/release
pypy package.py --archive-name pypy3-v6.0.0

This will create the prepared directory structure under /tmp/usession-release-pypy3.5-v6.0.0-0. Copy it to /opt and symlink the executable to /usr/local/bin:

sudo mv /tmp/usession-release-pypy3.5-v6.0.0-0/build/pypy3-v6.0.0 /opt
sudo ln -s /opt/pypy3-v6.0.0/bin/pypy3 /usr/local/bin

Now you can run PyPy 3 using the command:

pypy3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .