The question is very similar to the one already available. The only difference is that I ran Airflow in docker
Step by step:
- Put docker-compose.yaml to PyCharm project
- Put
requirements.txt
to PyCharm project - Run
docker-compose up
- Run DAG and receive a
ModuleNotFoundError
I want to start Airflow using docker-compose with the dependencies from requirements.txt
. These dependencies should be available by PyCharm interpreter and during DAGs execution
Is there a solution that doesn’t require rebuilding the image?
Advertisement
Answer
Is there a solution that doesn’t require rebuilding the image?
Yes there is now: currently (oct-2021 v2.2.0) it’s available as an env variable:
_PIP_ADDITIONAL_REQUIREMENTS
It is used in the docker-compose.yml file. That should do the trick without building a complete image as some of the other answers explain (very well actually :-)
See: https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml
Official documentation https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html#environment-variables-supported-by-docker-compose