Apache Airflow version
2.3.0
What happened
When using a PythonVirtualenvOperator it is checked if virtualenv is installed by
if not shutil.which("virtualenv"):
|
if not shutil.which("virtualenv"): |
Actually, this expression checks if
virtualenv is on PATH. If Airflow is installed in a virtual environment itself and
virtualenv is not installed in the environment the check might pass but
virtualenv cannot be used as it is not present in the environment.
What you think should happen instead
It should be checked if virtualenv is actually available in the environment.
if importlib.util.find_spec("virtualenv") is None:
raise AirflowException('PythonVirtualenvOperator requires virtualenv, please install it.')
https://stackoverflow.com/a/14050282
How to reproduce
No response
Operating System
Ubuntu 20.04
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
2.3.0
What happened
When using a
PythonVirtualenvOperatorit is checked ifvirtualenvis installed byif not shutil.which("virtualenv"):airflow/airflow/operators/python.py
Line 398 in a1679be
Actually, this expression checks if
virtualenvis on PATH. If Airflow is installed in a virtual environment itself andvirtualenvis not installed in the environment the check might pass butvirtualenvcannot be used as it is not present in the environment.What you think should happen instead
It should be checked if
virtualenvis actually available in the environment.https://stackoverflow.com/a/14050282
How to reproduce
No response
Operating System
Ubuntu 20.04
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct