-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModuleNotFoundError: No module named 'kafka'
in Airflow DAG
#3
Comments
After attempting to update the Docker Compose configuration with the following: environment:
- _PIP_ADDITIONAL_REQUIREMENTS="kafka-python" I encountered the following error:
It seems the quotes around the package name are causing the issue. I'll try to remove them and re-test. |
I removed the quotes around the package name in the Docker Compose configuration, as follows: environment:
- _PIP_ADDITIONAL_REQUIREMENTS=kafka-python After rebuilding the Airflow container, I verified that However, I still encounter the following error in Airflow webserver:
Additionally, when I enter the Airflow webserver container and run
|
After further research, I found that this issue is related to Python 3.12 compatibility. Specifically, the error is due to the
To resolve this, the suggested solution is to either downgrade to Python 3.11 or install an alternative package called To implement this solution, I updated the Docker Compose configuration to use the environment:
- _PIP_ADDITIONAL_REQUIREMENTS=kafka-python-ng I will rebuild the Docker container and verify if this resolves the issue. |
I encountered the following error in the Airflow webserver:
However, when I entered the Airflow webserver container and ran To fix this, I updated the Airflow scheduler container to include the environment:
- _PIP_ADDITIONAL_REQUIREMENTS=kafka-python-ng After rebuilding the scheduler container with this change, the issue was resolved, and the DAG is now working properly. |
I encountered an issue with the Airflow DAG
kafka_to_hdfs.py
. The DAG is failing due to a missing Python module,kafka
. The error traceback is as follows:The text was updated successfully, but these errors were encountered: