LogoLogo
  • Welcome to Gretel!
  • Gretel Basics
    • Getting Started
      • Quickstart
      • Blueprints
      • Use Case Examples
      • Environment Setup
        • Console
        • SDK
      • Projects
      • Inputs and Outputs
      • Gretel Connectors
        • Object Storage
          • Amazon S3
          • Google Cloud Storage
          • Azure Blob
        • Database
          • MySQL
          • PostgreSQL
          • MS SQL Server
          • Oracle Database
        • Data Warehouse
          • Snowflake
          • BigQuery
          • Databricks
        • Gretel Project
    • Release Notes
      • Platform Release Notes
        • April 2025
        • March 2025
        • February 2025
        • January 2025
        • December 2024
        • November 2024
        • October 2024
        • September 2024
        • August 2024
        • July 2024
        • June 2024
      • Console Release Notes
        • January 2025
        • December 2024
        • November 2024
        • October 2024
        • September 2024
        • August 2024
      • Python SDKs
  • Create Synthetic Data
    • Gretel Safe Synthetics
      • Transform
        • Reference
        • Examples
        • Supported Entities
      • Synthetics
        • Gretel Tabular Fine-Tuning
        • Gretel Text Fine-Tuning
        • Gretel Tabular GAN
        • Benchmark Report
        • Privacy Protection
      • Evaluate
        • Synthetic Quality & Privacy Report
        • Tips to Improve Synthetic Data Quality
        • Data Privacy 101
      • SDK
    • Gretel Data Designer
      • Getting Started with Data Designer
      • Define your Data Columns
        • Column Types
        • Add Constraints to Columns
        • Custom Model Configurations
        • Upload Files as Seeds
      • Building your Dataset
        • Seeding your Dataset
        • Generating Data
      • Generate Realistic Personal Details
      • Structured Outputs
      • Code Validation
      • Data Evaluation
      • Magic Assistance
      • Using Jinja Templates
  • Gretel Playground [Legacy]
    • Getting Started
    • Prompts Tips & Best Practices
    • FAQ
    • SDK Examples
    • Tutorials
    • Videos
    • Gretel Playground [Legacy] Inference API
    • Batch Job SDK
  • Reference
    • Gretel's Python Client
    • Gretel’s Open Source Synthetic Engine
    • Gretel’s REST API
    • Homepage
    • Model Suites
Powered by GitBook
On this page
  • Installation
  • Prerequisites
  • Gretel Client
  • Configure your Gretel session

Was this helpful?

Export as PDF
  1. Gretel Basics
  2. Getting Started
  3. Environment Setup

SDK

Get up and running with Gretel's Python SDK.

PreviousConsoleNextProjects

Last updated 25 days ago

Was this helpful?

Gretel's Python SDK is made available through both (most common) and .

Installation

Prerequisites

We require using Python 3.11+ when using the SDK. You can download Python 3.11 (or newer) and install manually, or you may wish to install Python 3.11+ . If you are working with a new Python installation or environment you should also .

Gretel Client

To get started, you will need to setup your environment and install the appropriate packages.

The most straightforward way to install the gretel-client SDK is with pip:

pip install -U gretel-client

The -U flag will ensure the most recent version is installed. Occasionally we will ship a Release Candidate (RC) version of the package. These are generally safe to install, you may optionally include this with the inclusion of the --pre flag.

If you wish to have the most recent development features, you may also choose to install directly from GitHub with the following command. This may be suggested from our Customer Success team if you are testing new features that have not been fully released yet.

pip install git+https://github.com/gretelai/gretel-python-client@main

Configure your Gretel session

Your Gretel session is configured upon instantiation of a Gretel object.

gretel = Gretel(api_key="prompt")

The default is to create or reuse a project called default-sdk-project . If you instead want to specify an existing project to use, you can reference it by its Project ID, available below the name on the Projects list view. Here is an example:

gretel = Gretel(api_key="prompt", default_project_id="example-project-7b2cb5d118e8a58")

If Gretel cannot find a project for the ID you specified, Gretel will create a new project for you. The new project's name will be the value you put in the ID. For example, the below code generates a project named example-project with an ID similar to that shown in the screenshot above.

gretel = Gretel(api_key="prompt", default_project_id="example-project")
PyPi
GitHub
here
from your terminal
verify that pip is installed