Skip to main content
Version: 1.0 prerelease

Set up a Python environment

Great Expectations (GX) is a library for Python versions 3.8 to 3.11. To utilize GX 1.0, you will first need to install Python. It is also advised that you set up a virtual environment for your GX Python projects.

Prerequisites

  • Internet access
  • Permissions to download and install packages in your environment

Install Python

  1. Reference the official Python documentation to install an appropriate version of Python.

GX Requires Python, version 3.8 to 3.11, which can be found on the official Python downloads page.

  1. Verify your Python installation.

Run the following command to display your Python version:

Terminal input
python --version

You should receive a response similar to:

Terminal output
Python 3.8.6

(Optional) Create a virtual environment

Although it is an optional step the best practice when working with a Python project is to do so in a virtual environment. A virtual environment ensures that any libraries and dependencies that you install as part of your project do not encounter or cause conflicts with libraries and dependencies installed for other Python projects.

There are various tools such as virtualenv and pyenv which can be used to create a virtual environment. This example uses venv because it is included with Python 3.

  1. Create the virtual environment with venv.

To create your virtual environment, run the following code from the folder the environment should reside in:

Terminal input
python -m venv my_venv

This command creates a new directory named my_venv which will contain your virtual environment.

Virtual environment names

If you wish to use a different name for your virtual environment, replace my_venv in the example with the name you would prefer. You will also have to replace my_venv with your virtual environment's actual name in any other example code that includes my_venv.

  1. (Optional) Test your virtual environment by activating it.

Activate your virtual environment by running the following command from the folder it was installed in:

Terminal input
source my_venv/bin/activate

Next steps