Skip to content

Get Started with RAI in a Local Python Environment

This guide walks you through the steps to set up a local Python development environment with the relationalai package. This setup is ideal for developing, testing, and deploying applications built with RAI.

Select your operating system and follow the steps to install Python on your machine:

  1. Navigate to the Python 3.11 download page, scroll down to the Files section, and download the Windows installer (64-bit).

  2. Open the installer and follow the prompts to install Python 3.11. Check the box to add Python to your PATH.

  3. Open a terminal and verify that Python 3.11 is installed by running:

    Terminal window
    python --version

    The output should be similar to Python 3.11.9.

Create a new project directory and virtual environment and use pip to install the relationalai package:

Terminal window
mkdir rai-getting-started && cd rai-getting-started
# Create a virtual environment.
python -m venv .venv
# Activate the virtual environment.
.venv\Scripts\activate
# Install the relationalai package.
python -m pip install relationalai

Run rai init to connect to your Snowflake account and configure your project:

Terminal window
rai init

Follow the interactive prompts to enter your Snowflake credentials and choose the:

Verify that the relationalai package is installed and working correctly by running the following code:

import relationalai as rai
# Create a model named "MyFirstModel".
model = rai.Model("MyFirstModel")
# Send a test query.
with model.query() as select:
response = select(1 + 1)
# The results are stored as a pandas DataFrame in the response.results attribute.
print(response.results)
# v
# 0 2