rustikk opened a new issue #20392:
URL: https://github.com/apache/airflow/issues/20392


   ### Apache Airflow version
   
   2.2.2 (latest released)
   
   ### What happened
   
   When specifying the version in the PythonVirtualenvOperator it fails to find 
the version 2.7 and as a result causes the task to fail. As I was writing this 
issue I decided to test version 3 and version 3.6, 3.7, and 3.8 also face this 
same issue. Python version 3.9.9 is the version of the python running airflow 
and when specifying the version to 3.9 it finds the version and installs it 
correctly.
   
   ### What you expected to happen
   
   I expected the PythonVirtualenvOperator to be able to find the version 
specified and install it successfully. 
   
   ### How to reproduce
   
   from airflow.models import DAG
   from airflow.operators.python import PythonVirtualenvOperator
   from airflow.utils.dates import days_ago
   
   import sys
   
   def py2_venv():
       import sys
       inner_version = sys.version[0:3] #'2.7'
       print("inner", inner_version)
       print("inner passed in", "".join(virtualenv_string_args[0][0:3]))
       print("outer", virtualenv_string_args[1][0:3])
   
   with DAG(
       dag_id="python_version_2",
       schedule_interval=None,
       start_date=days_ago(2)
   ) as dag:
   
       pv0 = PythonVirtualenvOperator(
           task_id="check_version",
           python_callable=py2_venv,
           string_args=["2.7", f"{sys.version}"],
           python_version=2.7)
   
   ### Operating System
   
   Docker (debian:buster)
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   Utilizing astronomer's astro CLI
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to