Quick Links
|
pypy is an alternative interpreter for the python language implementing just-in-time compilation and a stackless mode. In some tests it can be significantly faster than the original CPython interpreter and may consume less memory. However, only a subset of python packages is compatible with pypy. In particular, C extensions written for Python may not compile unmodified against pypy. And if they do compile, there is more overhead than in the CPython intepretor resulting in fewer if any speed gains over pure python in pypy.
Unlike our installations of the CPython interpreter, pypy is not installed as an anaconda environment and only contains a small set of packages.
There may be multiple versions of pypy available. An easy way of selecting the version is to use modules. To see the modules available, type
module avail pypy
To select a module use
module load pypy/[version]
where [version]
is the version of choice. For pypy, the version
includes the python version implemented as well as the version of pypy itself.
pypy modules include some tools to create python virtual environments. For example
[user@biowulf]$ module load pypy/2.7-7.3.5 [user@biowulf]$ virtualenv ./testenv created virtual environment PyPy2.7.18.final.42-64 in 4959ms creator PyPy2Posix(dest=/spin1/users/$USER/temp/tmp/testenv, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/spin1/home/linux/$USER/.local/share/virtualenv) added seed packages: pip==20.3.4, setuptools==44.1.1, wheel==0.36.2 activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator [user@biowulf]$ source testenv/bin/activate (testenv) [user@biowulf]$ which pypy /data/user/testenv/bin/pypy (testenv) [user@biowulf]$ which pip /data/user/testenv/bin/pip (testenv) [user@biowulf]$ pip install simplejson Collecting simplejson Using cached simplejson-3.17.2.tar.gz (83 kB) Building wheels for collected packages: simplejson Building wheel for simplejson (setup.py) ... done Created wheel for simplejson: filename=simplejson-3.17.2-py2-none-any.whl size=55458 sha256=42a6a591739f95c5f8f22ffc8d86ed4c3cbed8f8faf5db9b2670fc1048ef9b58 Stored in directory: /spin1/home/linux/$USER/.cache/pip/wheels/1c/ee/81/914783885103786e487047c47c6ee815477fc941aba11f0141 Successfully built simplejson Installing collected packages: simplejson Successfully installed simplejson-3.17.2 (testenv) [user@biowulf]$ pip freeze cffi==1.14.5 greenlet==0.4.13 readline==6.2.4.1 simplejson==3.17.2 (testenv) [user@biowulf]$ deactivate [user@biowulf]$