How to install PYPY3 on Ubuntu, for newbies?
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 directoryCould someone please tell me what to do. (have read the readme, the install docs at pypy.org and lots of posts)
55 Answers
All the answers here are either outdated or unnecessarily complicated.
sudo add-apt-repository ppa:pypy/ppa
sudo apt update
sudo apt install pypy3As simple as that!
See for details.
2This 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/pypyYou will get PyPy prompt.
Note that PyPy 3 is not fully done. This is preview version that is inteded for testing.
1Here's installing section of download page from PyPy's website:
All binary versions are packaged in a
tar.bz2orzipfile. 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/pypyto/path/to/pypy2-5.10.0/bin/pypy. Do not move or copy the executablepypyoutside 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 \
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/pypy3After that you can create virtual environments as usual:
virtualenv -p pypy3 some_env Or with snap:
sudo snap install pypy3 --classic 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
tar -xjf pypy3-v6.0.0-src.tar.bz2
cd pypy3-v6.0.0-srcOr you can download it from the Mercurial repository and switch to the 3.5 branch:
hg clone
cd pypy
hg update py3.5PyPy 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 pypyNow 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-devRun the translation (compilation):
cd pypy/goal # pypy3-v6.0.0-src/pypy/goal
pypy ../../rpython/bin/rpython -Ojit targetpypystandaloneEven 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.0This 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/binNow you can run PyPy 3 using the command:
pypy3