Getting error in Visual code studio "ImportError: cannot import name 'DummyOperator' from 'airflow.operators'
Asked Answered
Q

1

6

Getting error while running the airflow DAG code in visual studio code.

Error

ImportError: cannot import name 'DummyOperator' from 'airflow.operators' (c:\Users\10679196\AppData\Local\Programs\Python\Python38\lib\site-packages\airflow\operators\__init__.py)

Import Statement

from airflow import DAG
from airflow.operators import DummyOperator

Version

apache-airflow : 2.4.2
python : 3.8.1
pip : 22.3
Query answered 7/11, 2022 at 11:23 Comment(4)
try to install the apache-airflow module - pip install apache-airflow or add it to your requirements fileSirloin
Already tried to install apache-airflow module but it shows requirement already satisfiedQuery
What version of AF are u using?Sirloin
Sorry for late reply but issue was testing in local env . Working fine when tested in airflow DAGQuery
D
22

As per documentation the DummyOperator is deprecated and beginning with the version 2.4.0 is not supported any more. You should use

from airflow.operators.empty import EmptyOperator

BTW your old import seems also incorrect. For airflow < 2.4.0 this should work:

from airflow.operators.dummy import DummyOperator
Daffi answered 8/11, 2022 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.