# How to Install PyPy and Use it?

**PyPy** is an implementation of Python written in **RPython** (Reduced Python) language, and it is seen as a replacement for CPython.

PyPy claims that it is almost a drop-in replacement for CPython and can beat it on speed and memory usage. It supports libraries like *Django*, *NumPy*, *Scikit-learn*, and *Twisted*, and comes with the stackless mode, providing micro-threads for massive concurrency.

In this article, we’ll see how to install and use PyPy in our system.

## Installation

PyPy comes with Python3 and Python2. Click [here](https://pypy.org/download.html) to download the pre-built binary that is compatible with your system.

![Download PyPy](https://cdn.hashnode.com/res/hashnode/image/upload/v1734191593153/42d7c040-0037-4021-915e-71a2947a01cb.png align="center")

After downloading PyPy, you’ll get a compressed folder in your system. Now extract the content of the PyPy’s build folder into the desired path, and that’s it.

![Extracted PyPy build](https://cdn.hashnode.com/res/hashnode/image/upload/v1734192165709/104af072-04bf-4621-b6e3-dc8890f8a443.png align="center")

But how to use it because we didn’t add PyPy’s path to system variables like we used to do in the case of CPython installation?

## How to Use PyPy?

It is recommended to use PyPy using a virtual environment. Let’s see how we can use PyPy from a virtual environment.

We’ll use [virtualenv](https://pypi.org/project/virtualenv/) package to create a virtual environment. It is compatible with both CPython and PyPy. You’ll need to install this package (`pip install virtualenv`) to get started.

Open the command prompt or terminal and run the following command:

```python
PS > virtualenv -p D:/SACHIN/pypy310/pypy.exe pypyenv
```

Let’s understand what the above command does:

* `virtualenv`: A command to create a virtual environment using `virtualenv`.
    
* `-p`: Specifies the path to the Python interpreter that will be used in the virtual environment. It can also be written `--python`.
    
* `D:/SACHIN/pypy310/pypy.exe`: Path to PyPy interpreter.
    
* `pypyenv`: Species the name of the virtual environment.
    

Run the command and PyPy will be ready to use.

You can check if you are using PyPy by running the following command:

```python
PS > cd pypyenv
PS > Scripts/activate
(pypyenv) PS > cd ..
(pypyenv) PS > python --version
Python 3.10.14 (39dc8d3c85a7, Aug 27 2024, 14:33:33)
[PyPy 7.3.17 with MSC v.1929 64 bit (AMD64)]
```

You’ll notice that we used `python` command to check the version of PyPy installed on the system because in the virtual environment, the `python` command becomes a symlink (or equivalent) to the interpreter used when creating the virtual environment.

## Installing Modules Using PyPy

The following command is used to install third-party modules using PyPy:

```python
PS > pypy -m pip install module_name
```

You can directly install modules without writing `pypy -m`, if you are using PyPy as the main interpreter. If you are using PyPy within an isolated environment then activate the environment and use the above command to avoid any error.

Some third-party libraries such as **Scipy** create problems during the installation, so in that case, you can use [conda](https://doc.pypy.org/en/latest/install.html#using-conda) with pypy3.9.

---

**That’s all for now.**

**Keep Coding✌✌**
