Skip to content

Example for running on AWS (Glue, EMR, SageMaker, etc) #140

Description

@chenliu0831

Is your feature request related to a problem? Please describe.
Running PyDeequ on Glue, EMR is not always easy due to the packaging and unique env settings etc. Users commonly need to trail and error a while.

Describe the solution you'd like

it would be good to provide a sample notebook of some sort that are ready to use. Perhaps a code snippets as well.

Alternatives

It may worth consider an AWS service integration helper module (data sources & compute service).

Workaround available:

Activity

  1. candicexu918 commented on Jul 15, 2023

    @candicexu918

    The new released pydeequ can be installed successfully in Glue but somehow failed to be imported with error "RuntimeError: SPARK_VERSION environment variable is required. Supported values are: dict_keys(['3.3', '3.2', '3.1', '3.0', '2.4'])", which results from the get_spark_version function in the config file.

    In Glue when I ran the below code it returned null -

    SPARK_VERSION = os.environ.get('SPARK_VERSION')
    print(SPARK_VERSION)
    

    But when I ran print(spark.version[:3]) it did return '3.1' as expected.

    Is this something can be enhanced in the package or should I explore other ways to use pydeequ in Glue?

  2. chenliu0831 commented on Jul 18, 2023

    @chenliu0831
    Author

    @candicexu918 This is a workaround #138 (comment). Glue may have a unique setup of how you could pass env var to Python process

  3. github-actions commented on May 18, 2026

    @github-actions
    Contributor

    This is a known pain point. The SPARK_VERSION environment variable is required because pydeequ/configs.py reads it at import time via os.environ["SPARK_VERSION"], and AWS Glue doesn't set this variable by default.

    Workaround: Set the environment variable before importing pydeequ:

    import os
    os.environ["SPARK_VERSION"] = "3.3"  # or whatever your Glue Spark version is
    
    import pydeequ

    Alternatively, if you already have a SparkSession available, you can detect it dynamically:

    import os
    from pyspark.sql import SparkSession
    spark = SparkSession.builder.getOrCreate()
    os.environ["SPARK_VERSION"] = spark.version
    
    import pydeequ

    The root issue is that configs.py resolves the Spark version at module load time and only checks the environment variable — it doesn't attempt to detect the version from an active SparkSession. An enhancement to auto-detect from the runtime Spark version (falling back to the env var) would be a welcome PR. For now, the workaround above is the recommended approach for Glue, EMR, and SageMaker environments.


    Generated by AI (model: us.anthropic.claude-opus-4-6-v1, prompt: cf3780e5) — may not be fully accurate. Reply if this doesn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions