question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: ModuleNotFoundError: No module named 'airflow' | Docker Image Windows WSL2

See original GitHub issue

Apache Airflow version: 2.0.0

Kubernetes version (if you are using kubernetes) (use kubectl version): NA

Environment: Local Windows Laptop

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release): Windows 10 (WSL 2)
  • Install tools: Docker desktop in Windows 10 (WSL2)
  • Others:

What happened:

I am trying to setup local development with Airflow and was using the Docker-compose.yaml file in the repo. I am encountering the below error when I issues the command ‘docker-compose up airflow-init’

Starting airflowdocker_redis_1 … done Starting airflowdocker_postgres_1 … done Starting airflowdocker_airflow-init_1 … done Attaching to airflowdocker_airflow-init_1 airflow-init_1 | DB_BACKEND=postgresql+psycopg2 airflow-init_1 | DB_HOST=postgres airflow-init_1 | DB_PORT=5432 airflow-init_1 | airflow-init_1 | Traceback (most recent call last): airflow-init_1 | File “/home/airflow/.local/bin/airflow”, line 5, in airflow-init_1 | from airflow.main import main airflow-init_1 | ModuleNotFoundError: No module named ‘airflow’ airflowdocker_airflow-init_1 exited with code 1

What you expected to happen: I expected the containers to start and login to airflow via localhost:8080

How to reproduce it: Get the docker-compose.yaml from the repo. and then just follow the instructions on a windows machine.

Anything else we need to know: This occurs everytime

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
turbaszekcommented, Feb 6, 2021

I had this problem yesterday - it was down to the user config. It was fixed by setting in docker-compose:

user: "${AIRFLOW_UID:-1000}:${AIRFLOW_GID:-0}"
1reaction
anilkulkarni87commented, Feb 7, 2021

Yes i noticed that and accommodated that change. Would like you review it and probably test in another machine. Please let me know.

The airflow init through /bin/bash did not work for me. I had tweak that

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named 'airflow' when initializing Apache airflow ...
I found the problem. There is a bug on version 2.0.1 that doesn't let you run the airflow containers using root.
Read more >
[GitHub] [airflow] mik-laj commented on issue #14111: Error ...
[GitHub] [airflow] mik-laj commented on issue #14111: Error: ModuleNotFoundError: No module named 'airflow' | Docker Image Windows WSL2.
Read more >
Running Airflow in Docker
ModuleNotFoundError : No module named 'XYZ'​​ The Docker Compose file uses the latest Airflow image (apache/airflow). If you need to install a new...
Read more >
Airflow error using Docker: No module named <package>
I created a DAG to run a python script using bash operator but I am getting a modulenotfound error in the Airflow logs....
Read more >
Run Apache Airflow on Windows 10 without Docker
Everything is fine if you see something like Apache Airflow [1.10.12] · If you get errors due to missing packages, install them with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found