25

I have a Linux-64 bit machine. How do I install PyPy in my anaconda environment. I tried conda install pypy. It says there are no available packages. pip install pypy also returns a similar message. Is it that the only way to install PyPy is by downloading the tar.gz file from the website? Once installed, how do I configure my Anaconda environment in such a way so as to be able to switch from PyPy to other Python implementations when required?

Menezes Sousa
  • 1,448
  • 2
  • 18
  • 18
  • I don't think that this is possible. Keep in mind that `pypy` is not just some package that extends python but a completely new implementation of the python interpreter in pure python. Many packages at the root of the scientific package stack ( e.g. `numpy`, `scipy`) are not (yet?) fully supported by `pypy`. So AFAICT, `pypy` is not widely adopted in scientific python community. I think there will be no solution to this is the near future. – cel Mar 15 '15 at 09:01
  • 2
    @cel Note that conda is a python agnostic package manager (e.g., you can install R via a conda package, and it should be equally possible to do that for pypy. But someone has to first write a recipe for it, build it and make it available) – jorgeca Oct 31 '15 at 00:14

5 Answers5

20

conda-forge now supports PyPy3.6 as the python interpreter in a conda environment (see the official blog post):

conda config --set channel_priority strict
conda create -n pypy pypy
conda activate pypy

And then use it like your regular python executable (notice that this is a different Python interpreter, not a package)

pypy3 -c "import sys; print(sys.version)"

It works on Linux and OSX.

Ohad
  • 2,752
  • 17
  • 15
9

NOTE: conda-pypy is archived, this answer outdated, and conda-forge is in the process of producing PyPy packages. You should use that instead.

There is an alternative approach maintained by Riccardo Vianello on GitHub:

https://github.com/rvianello/conda-pypy

It basically involves using his conda channel instead of the default one to install necessary packages. Some basic ones are provided.

astrojuanlu
  • 6,744
  • 8
  • 45
  • 105
3

In addition to Ohad's answer, create a new environment to house pypy first. PyPy wouldn't install for my base configuration but did this way:

conda create -n <newenviromnentname>

Enter the enviromnent

conda activate <newenviromnentname>

install pypy to the environment

conda install -c conda-forge pypy3.6 

Then proceed to install the rest of the packages you need available.

C4rnot
  • 49
  • 1
0

As of 2021 Pypy 3.7 supports Python 3.7 go to conda environment Type> conda install -c conda-forge pypy3.7 (Ensure you are on py 3.7)

(pypy37) C:\Users\UserName>conda install -c conda-forge pypy3.7
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.10.1
  latest version: 4.10.3

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: C:\Users\Dios Dole\.conda\envs\pypy37

  added / updated specs:
    - pypy3.7


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    bzip2-1.0.8                |       h8ffe710_4         149 KB  conda-forge
    ca-certificates-2021.5.30  |       h5b45459_0         171 KB  conda-forge
    certifi-2021.5.30          |   py37h4c0cbd9_0         142 KB  conda-forge
    expat-2.4.1                |       h39d44d4_0         279 KB  conda-forge
    libffi-3.3                 |       h0e60522_2          37 KB  conda-forge
    openssl-1.1.1k             |       h8ffe710_0         5.7 MB  conda-forge
    pypy3.7-7.3.5              |       hb504520_5        31.1 MB  conda-forge
    python-3.7.10              |        1_73_pypy           5 KB  conda-forge
    python_abi-3.7             |    2_pypy37_pp73           4 KB  conda-forge
    tk-8.6.10                  |       h8ffe710_1         3.2 MB  conda-forge
    xz-5.2.5                   |       h62dcd97_1         211 KB  conda-forge
    zlib-1.2.11                |    h62dcd97_1010         126 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        41.2 MB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/win-64::bzip2-1.0.8-h8ffe710_4
  expat              conda-forge/win-64::expat-2.4.1-h39d44d4_0
  libffi             conda-forge/win-64::libffi-3.3-h0e60522_2
  pypy3.7            conda-forge/win-64::pypy3.7-7.3.5-hb504520_5
  python_abi         conda-forge/win-64::python_abi-3.7-2_pypy37_pp73
  tk                 conda-forge/win-64::tk-8.6.10-h8ffe710_1
  xz                 conda-forge/win-64::xz-5.2.5-h62dcd97_1
  zlib               conda-forge/win-64::zlib-1.2.11-h62dcd97_1010

The following packages will be UPDATED:

  python                pkgs/main::python-3.7.10-h6244533_0 --> conda-forge::python-3.7.10-1_73_pypy

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates    pkgs/main::ca-certificates-2021.7.5-h~ --> conda-forge::ca-certificates-2021.5.30-h5b45459_0
  certifi            pkgs/main::certifi-2021.5.30-py37haa9~ --> conda-forge::certifi-2021.5.30-py37h4c0cbd9_0
  openssl              pkgs/main::openssl-1.1.1k-h2bbff1b_0 --> conda-forge::openssl-1.1.1k-h8ffe710_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
ca-certificates-2021 | 171 KB    | ####################################################################################################################################################################### | 100%
python_abi-3.7       | 4 KB      | ####################################################################################################################################################################### | 100%
python-3.7.10        | 5 KB      | ####################################################################################################################################################################### | 100%
expat-2.4.1          | 279 KB    | ####################################################################################################################################################################### | 100%
certifi-2021.5.30    | 142 KB    | ####################################################################################################################################################################### | 100%
bzip2-1.0.8          | 149 KB    | ####################################################################################################################################################################### | 100%
libffi-3.3           | 37 KB     | ####################################################################################################################################################################### | 100%
tk-8.6.10            | 3.2 MB    | ####################################################################################################################################################################### | 100%
xz-5.2.5             | 211 KB    | ####################################################################################################################################################################### | 100%
zlib-1.2.11          | 126 KB    | ####################################################################################################################################################################### | 100%
pypy3.7-7.3.5        | 31.1 MB   | ####################################################################################################################################################################### | 100%
openssl-1.1.1k       | 5.7 MB    | ####################################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

After that to check Type> pypy --version

(pypy37) C:\Users\UserName>pypy --version
Python 3.7.10 (77787b8f4c49115346d1e9cbaf48734137417738, Jul 18 2021, 08:38:15)
[PyPy 7.3.5 with MSC v.1916 64 bit (AMD64)]
Ohm Dios
  • 43
  • 1
  • 5
-1

Puppy's version support can found here: http://pypy.org/download.html.

It is distributed specific, so if you don't have a supported district you can. Try using the build option.

Without more info on your Linux and python versions, it is hard to add more.

Harvey
  • 617
  • 8
  • 18
  • I am currently using Python 2.7.9 |Anaconda 2.1.0 (64-bit) OS: Linux 3.5.0-54-generic x86_64 Currently this is the Python that is run when I try to run any Python program. I want it to run PyPy instead of this. – Menezes Sousa Mar 15 '15 at 04:57