I'm not sure how to approach this issue -- other posts to do with ModuleNotFoundError are solved by reinstalling the relevant package, however it's clear that this is not the issue because the example bash operator DAG runs. So is my issue to do with how Airflow was installed? At this point I'm looking at reinstalling Airflow via the puckel Docker container.
[2020-12-23 01:02:24,705] {dagbag.py:259} ERROR - Failed to import: /home/pi/airflow/dags/dag_clist.py
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/airflow/models/dagbag.py", line 256, in process_file
m = imp.load_source(mod_name, filepath)
File "/usr/lib/python3.7/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pi/airflow/dags/dag_clist.py", line 7, in <module>
from airflow.operators.bash import BashOperator
ModuleNotFoundError: No module named 'airflow.operators.bash'
Other SO posts to do with the BashOperator:
Since you are using Airflow 1.10.14 The import should be
from airflow.operators.bash_operator import BashOperator
In Airflow >= 2.0.0 it's:
from airflow.operators.bash import BashOperator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With