Install Python
To use Great Expectations (GX) you need to install Python and the GX Core Python library. GX also recommends 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
-
Reference the official Python documentation to install an appropriate version of Python.
GX Requires Python, version 3.9 to 3.12, which can be found on the official Python downloads page.
-
Verify your Python installation.
Run the following command to display your Python version:
Terminal inputpython --version
You should receive a response similar to the following:
Terminal outputPython 3.9.19
Optional. Create a virtual environment
Although it is optional, 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 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.
-
Create the virtual environment with
venv
.To create your virtual environment, run the following code from the folder that the environment will be created in:
Terminal inputpython -m venv my_venv
This command creates a new directory named
my_venv
for your virtual environment.Virtual environment namesTo 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 replacemy_venv
with your virtual environment's actual name in any other example code that includesmy_venv
. -
Optional. Test your virtual environment by activating it.
Activate your virtual environment by running the following command from the same folder it was installed from:
Terminal inputsource my_venv/bin/activate