1

I am a new user of Airflow. I successfully set up the airflow locally. But when I try to import modules such as from airflow.decorators or airflow.operators.pythonOperators I receive an error as Import could not be resolved.

Below is the screenshot of my situation.

enter image description here

Receiving the same error on my localhost web-server:

enter image description here

Please help me out, as I am entirely new to apache-airflow

Edit: My current version of airflow is already 2.3.4

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
Aditya
  • 59
  • 7

1 Answers1

0

Airflow decorators are added in the version 2.2.0, you need just to upgrade your Airflow version

AIRFLOW_VERSION=2.3.4 # the version you want to use, it should be >= 2.2.0
PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)"
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"
Hussein Awala
  • 4,285
  • 2
  • 9
  • 23