[PYTHON] How to install PyPy on CentOS

Notes on installing PyPy on CentOS

After a lot of trial and error to install PyPy on CentOS, it was enough to drop it from the epel repository, so I'll leave a note. You can drop the source and compile it, but be prepared for the challenging type because it consumes a lot of memory and time.

wrap up

Since the text was long and full of logs, only the necessary commands are listed. Just download the rpm package from the epel repository.

# yum --enablerepo=epel,rpmforge,remi search pypy
# yum --enablerepo=epel,rpmforge,remi info pypy
# yum --enablerepo=epel install pypy
# yum --enablerepo=epel install pypy-devel

trial and error

I tried the following two methods to download from the PyPy page.

  1. [Linux x86 binary (64bit, tar.bz2 built on Ubuntu 12.04) in 2.2.1 of PyPy --Download .2 LTS)](https://bitbucket.org/pypy/pypy/downloads/pypy-2.2.1-linux64.tar.bz2) binary used
  1. Source (tar.bz2) in 2.2.1 of PyPy --Download Compile from .org / pypy / pypy / downloads / pypy3-2.1-beta1-src.tar.bz2) source

So I decided to look for the rpm package in the repository.

Installation from repository

Check CentOS version

Check the version of CentOS for the time being.

# cat /etc/redhat-release
CentOS release 6.5 (Final)

Search for PyPy with the yum search command

I did a yum search with the --enablerepo option, specifying to search from the epel, rpmforge, and remi repositories. If you have not added the repository in the first place, please add it referring to the following article.

# yum --enablerepo=epel,rpmforge,remi search pypy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.iij.ad.jp
 * remi: remi.kazukioishi.net
 * rpmforge: ftp.kddilabs.jp
 * updates: ftp.iij.ad.jp
=================================================================== N/S Matched: pypy ===================================================================
pypy-devel.i686 : Development tools for working with PyPy
pypy-devel.x86_64 : Development tools for working with PyPy
pypy-libs.x86_64 : Run-time libraries used by PyPy implementations of Python
pypy.x86_64 : Python implementation with a Just-In-Time compiler

  Name and summary matches only, use "search all" for everything.

Check repositories and other information with the yum info command

Yum search doesn't know which repository has PyPy, so use yum info to identify it. Also check the version.

# yum --enablerepo=epel,rpmforge,remi info pypy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.iij.ad.jp
 * remi: remi.kazukioishi.net
 * rpmforge: ftp.kddilabs.jp
 * updates: ftp.iij.ad.jp
Available Packages
Name        : pypy
Arch        : x86_64
Version     : 2.0.2
Release     : 1.el6
Size        : 7.3 M
Repo        : epel
Summary     : Python implementation with a Just-In-Time compiler
URL         : http://pypy.org/
License     : MIT and Python and UCD
Description : PyPy's implementation of Python, featuring a Just-In-Time compiler on some CPU
            : architectures, and various optimized implementations of the standard types
            : (strings, dictionaries, etc)
            :
            :
            : This build of PyPy has JIT-compilation enabled.

Install with the yum install command

According to the information so far, pypy is in the epel repository, so specify epel for --enablerepo and install it.

# yum --enablerepo=epel install pypy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pypy.x86_64 0:2.0.2-1.el6 will be installed
--> Processing Dependency: pypy-libs = 2.0.2-1.el6 for package: pypy-2.0.2-1.el6.x86_64
--> Running transaction check
---> Package pypy-libs.x86_64 0:2.0.2-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================
 Package                               Arch                               Version                                 Repository                        Size
=========================================================================================================================================================
Installing:
 pypy                                  x86_64                             2.0.2-1.el6                             epel                             7.3 M
Installing for dependencies:
 pypy-libs                             x86_64                             2.0.2-1.el6                             epel                             5.0 M

Transaction Summary
=========================================================================================================================================================
Install       2 Package(s)

Total download size: 12 M
Installed size: 70 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): pypy-2.0.2-1.el6.x86_64.rpm                                                                                                | 7.3 MB     00:01
(2/2): pypy-libs-2.0.2-1.el6.x86_64.rpm                                                                                           | 5.0 MB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                    4.6 MB/s |  12 MB     00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : pypy-libs-2.0.2-1.el6.x86_64                                                                                                          1/2
  Installing : pypy-2.0.2-1.el6.x86_64                                                                                                               2/2
  Verifying  : pypy-2.0.2-1.el6.x86_64                                                                                                               1/2
  Verifying  : pypy-libs-2.0.2-1.el6.x86_64                                                                                                          2/2

Installed:
  pypy.x86_64 0:2.0.2-1.el6

Dependency Installed:
  pypy-libs.x86_64 0:2.0.2-1.el6

Complete!

Also include devel

Let's put in devel for the time being.

# yum --enablerepo=epel install pypy-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.iij.ad.jp
 * remi: remi.kazukioishi.net
 * rpmforge: ftp.kddilabs.jp
 * updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pypy-devel.x86_64 0:2.0.2-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================
 Package                               Arch                              Version                                   Repository                       Size
=========================================================================================================================================================
Installing:
 pypy-devel                            x86_64                            2.0.2-1.el6                               epel                             35 k

Transaction Summary
=========================================================================================================================================================
Install       1 Package(s)

Total download size: 35 k
Installed size: 88 k
Is this ok [y/N]: y
Downloading Packages:
pypy-devel-2.0.2-1.el6.x86_64.rpm                                                                                                 |  35 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : pypy-devel-2.0.2-1.el6.x86_64                                                                                                         1/1
  Verifying  : pypy-devel-2.0.2-1.el6.x86_64                                                                                                         1/1

Installed:
  pypy-devel.x86_64 0:2.0.2-1.el6

Complete!

Operation check

Hello World

Run the classic Hello World.

$ pypy
Python 2.7.3 (f66246c46ca30b26a5c73e4cc95dd6235c966b8f, Jul 30 2013, 09:27:06)
[PyPy 2.0.2 with GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> print("Hello World")
Hello World

It was displayed.

Comparison of execution times.

Compare the execution time with the function used in Comparison of execution time of CPython and PyPy.

CPython

>>> rangelist = range(1,10000000)
>>> print reduce(lambda x, y: x + y, [testfunc1(rangelist) for temp in range(10)])/10
0:00:01.717502
>>> print reduce(lambda x, y: x + y, [testfunc2(rangelist) for temp in range(10)])/10
0:00:01.183652
>>> print reduce(lambda x, y: x + y, [testfunc3(rangelist) for temp in range(10)])/10
0:00:00.734407

PyPy

>>> rangelist = range(1,10000000)
>>> print reduce(lambda x, y: x + y, [testfunc1(rangelist) for temp in range(10)])/10
0:00:01.017655
>>> print reduce(lambda x, y: x + y, [testfunc2(rangelist) for temp in range(10)])/10
0:00:00.983054
>>> print reduce(lambda x, y: x + y, [testfunc3(rangelist) for temp in range(10)])/10
0:00:00.250842

Execution time in PyPy is much shorter than in CPython.

Recommended Posts

How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
How to install Maven on CentOS
How to install Apache (httpd) on CentOS7
How to install Eclipse GlassFish 5.1.0 on CentOS 7
How to install Apache (httpd) on CentOS8
Steps to install MySQL 8.0 on CentOS 8.1
How to install mysql-connector-python on mac
Steps to install VirtualBox on CentOS
How to install graph-tool on macOS
How to install Git GUI and Gitk on CentOS
How to install VMware-Tools on Linux
How to install OpenCV on Mac
How to install Go on Ubuntu
How to install music 21 on windows
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
How to install drobertadams / toggl-cli on Mac
[Kivy] How to install Kivy on Windows [Python]
How to install packages on Alpine Linux
How to install Anisble on Amazon Linux 2
How to switch mouse operations on CentOS
How to install richzhang / colorization on Windows 10
How to update security on CentOS Linux 8
How to install php7.4 on Linux (Ubuntu)
How to install NumPy on Raspberry Pi
How to install cx_Oracle on macOS Sierra
How to install python3 with docker centos
Install Faiss on CentOS 7
How to install Python
How to install pip
How to install archlinux
Install numba on CentOS 7.2
How to install python
How to install BayesOpt
Install mecab-python on CentOS
Install Python 2.7.3 on CentOS 5.4
How to install Nbextensions
How to install Prover9
Install awscli on centos7
Install Chainer on CentOS 6.7
[2020 version] How to install Python3 on AWS EC2
How to install OpenCV on Jetson Nano Python
How to quickly install h5py on Windows 10 [Unofficial]
How to install OpenGM on OSX with macports
How to install Camunda Modeler on Manjaro Linux
[Python] How to install OpenCV on Anaconda [Windows]
How to install / verify graphviz on anaconda / windows10
[2020.8 latest] How to install Python
Tabpy 1.0 (2020-01 version) How to install
Install ImageMagick-6.2.x series on CentOS7.7
How to register on pypi
How to install mkl numpy
Install Chrome on CentOS 7 series
Install Python 3.8 on CentOS 8 (AppStream)
How to install Pelican blog
How to install Linux on a 32bit UEFI PC
How to install caffe on OS X with macports
[Note] How to give sudo authority to user on CentOS
[AWS EC2] How to install Maven on Amazon Linux 2
How to install git on Linux such as EC2
How to install python using anaconda