When running Geneva UDFs on distributed workers, your code is serialized locally and executed on remote workers. If the worker environment differs from your local environment, you may encounter subtle and difficult-to-debug errors.
Example environment mismatch errors
These issues are notoriously difficult to debug because the error messages often don’t indicate the root cause.
Geneva provides a diagnostic tool to compare your local environment against Ray workers.
If you are encountering a hang or exception you can use the following diagnosis worklflow to resolve the problem.
Run the diagnostic tool programatically or via the CLI.
Check PACKAGES and ENV VARS output sections for mismatches.
Identify critical packages: numpy, torch, pyarrow, attrs, pydantic.
Identify inconsistent environment variables: AWS_*, GOOGLE_APPLICATION_CREDENTIALS
Fix with manifest for quick testing:
OPTIONAL: Build custom image for production (if using KubeRay).
Programmatic Usage
CLI Usage
Understanding the Output
The tool outputs several sections to help you identify mismatches.
Shows Python version and OS information for both environments:
Watch for different Python versions or different OS types (macOS local vs Linux remote).
Architecture Mismatch (macOS to Linux)
If you see different OS types (e.g., Darwin locally vs Linux remotely), compiled extensions may fail with ModuleNotFoundError or segfaults.
Solution: Run Geneva from the same OS/architecture as your cluster (typically Linux x86_64). Use a Linux VM, container, or remote development environment.
Environment Variables
Environment variables present in only one environment:
Missing AWS_* or GOOGLE_APPLICATION_CREDENTIALS can cause storage authentication failures.
Passing Environment Variables to Workers
If critical environment variables are missing on workers, you can pass them via the manifest or cluster configuration.
Option 1: Via Manifest
Option 2: Via Cluster Configuration
Avoid hardcoding secrets. Use os.environ to pass values from your local environment, or use a secrets manager in production.
Packages
The tool shows version mismatches and packages only present in one environment:
Watch for major version differences (NumPy 1.x vs 2.x) and PyTorch version mismatches.
Common Package Issues
Fixing Package Mismatches
Option 1: Manifest pip Dependencies
Specify packages in a Geneva manifest for a quick fix:
Pros: Quick, reusable across sessions, stored with your database.
Cons: Slower startup (downloads packages), may not work for complex dependencies.
Option 2: Custom Ray Worker Image
For KubeRay deployments, build a custom worker image:
Then reference in RayCluster spec:
Pros: Fastest startup, reproducible.
Cons: Requires image build/push workflow.
Option 3: Conda Environment
Use a conda environment on workers via the cluster builder:
Or specify conda channels and dependencies inline:
Pros: Best for complex dependencies with native libraries (ffmpeg, CUDA).
Cons: Slower environment creation, requires conda on workers.
API Reference
For detailed API documentation on the environment comparison functions, see the Geneva Diagnostics API Reference.