From 7bc13365ef9ffe8cf1bf4d0d59a5f03ad25792f9 Mon Sep 17 00:00:00 2001 From: Matt Rixman Date: Tue, 11 May 2021 17:16:17 -0600 Subject: [PATCH] error early if virtualenv is missing --- airflow/operators/python.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/airflow/operators/python.py b/airflow/operators/python.py index c13b002429598..511cb992d7611 100644 --- a/airflow/operators/python.py +++ b/airflow/operators/python.py @@ -18,6 +18,7 @@ import inspect import os import pickle +import shutil import sys import types import warnings @@ -325,6 +326,8 @@ def __init__( "Passing op_args or op_kwargs is not supported across different Python " "major versions for PythonVirtualenvOperator. Please use string_args." ) + if not shutil.which("virtualenv"): + raise AirflowException('PythonVirtualenvOperator requires virtualenv, please install it.') super().__init__( python_callable=python_callable, op_args=op_args,