Installation

This guide teaches how to use Py-EVM as a library. For contributors, please check out the Contributing Guide which explains how to set everything up for development.

Installing Python on Ubuntu

Py-EVM requires Python 3 as well as some tools to compile its dependencies. On Ubuntu, the python3.9-dev package contains everything we need. Run the following command to install it.

apt-get install python3.9-dev

Py-EVM is installed through the pip package manager, if pip isn’t available on the system already, we need to install the python3-pip package through the following command.

apt-get install python3-pip

Installing Python on macOS

First, install Python 3 with brew:

brew install python3

Installing py-evm

Note

Optional: Often, the best way to guarantee a clean Python 3 environment is with virtualenv. If we don’t have virtualenv installed already, we first need to install it via pip.

pip install virtualenv

Then, we can initialize a new virtual environment venv, like:

virtualenv -p python3 venv

This creates a new directory venv where packages are installed isolated from any other global packages.

To activate the virtual directory we have to source it

. venv/bin/activate

Then, make sure to have the latest version of pip so that all dependencies can be installed correctly:

pip3 install -U pip

Finally, install the py-evm package via pip:

pip3 install -U py-evm

Hint

Build a first app on top of Py-EVM in under 5 minutes