airflow-code-editor icon indicating copy to clipboard operation
airflow-code-editor copied to clipboard

How do I install extra packages from the code editor

Open ash-lyrid opened this issue 3 years ago • 1 comments

Hi Team,

Is there a way we could install some dependent packages of the Dags which are hosted on PyPi via code editor. Maybe running requirements.txt file programatically/ button?

Thanks

ash-lyrid avatar Jun 29 '22 14:06 ash-lyrid

You can install the requirements creating (and starting manually) a dag like the following:

from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.utils.dates import days_ago

dag = DAG( dag_id='update-requirements', schedule_interval=None, start_date=days_ago(1) )

pip_install_requirements = BashOperator( task_id='pip_install_requirements ', bash_command="pip install -r requirements.txt", dag=dag )

if name == "main": dag.cli()

andreax79 avatar Jul 26 '22 13:07 andreax79