Home:ALL Converter>ModuleNotFoundError - Airflow cannot find a packaged module

ModuleNotFoundError - Airflow cannot find a packaged module

Ask Time:2021-10-27T02:48:18         Author:thehungrypanda121

Json Formatter

Airflow beginner here. I recently installed Airflow and am in the process of creating a DAG. My issue is that when I run Airflow, I get the error that it cannot find my package of "etl_package". This is odd b/c this package is in the same directory (C:\Users\username\AppData\Roaming\Python\Python37\site-packages) as the airflow packages used in my code. I've verified this is on my PYTHONPATH.

from airflow import DAG
from datetime import datetime
from airflow.operators.python import PythonOperator
from etl_package.data_collect.dropbox_download_file import DownloadMoveFiles as dlm

with DAG("mydag", start_date=datetime(2020, 1, 1),
         schedule_interval="@daily", catchup=False) as dag:


    collect_data = PythonOperator(
        task_id="dbx_collection",
        python_callable=dlm.collect_move
    )

I think the error might be the location of my DAGS folder. It currently resides on my desktop and thus is not in the root folder of where the rest of my python code is. However, if this is the issue, then I'm confused as to why Airflow can recognize the imported airflow modules. Thank you and appreciate any help.

Author:thehungrypanda121,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/69728459/modulenotfounderror-airflow-cannot-find-a-packaged-module
yy