airflow-tutorial
airflow-tutorial copied to clipboard
webserver_1 | NameError: name '_mysql' is not defined
webserver_1 | NameError: name '_mysql' is not defined
Same thing. is this issue solved already?
I have this same issue.
I have mySQL 8.0.26, Postgres 12, Kubernetes and SQLite. I installed those packages manually and still have this issue.
I have used mySQL for other projects before and never got this issue, however I'm a novice at using Docker containers.
I followed the instructions on a separate issue (linked below) and they helped me with the _msql issue.
Roughly the fix was making sure apache-airflow was installed, updating the puckel/docker-airflow from version 1.10.1 to 1.10.9, and updating sqlalchemy from 1.2.0 to 1.3.0. The exact docker-compose-yml is available in the comment linked below.
https://github.com/tuanavu/airflow-tutorial/issues/51#issuecomment-901978083
I followed the instructions on a separate issue (linked below) and they helped me with the _msql issue.
Roughly the fix was making sure apache-airflow was installed, updating the puckel/docker-airflow from version 1.10.1 to 1.10.9, and updating sqlalchemy from 1.2.0 to 1.3.0. The exact docker-compose-yml is available in the comment linked below.
correct, this https://github.com/tuanavu/airflow-tutorial/issues/51#issuecomment-901978083 as well as this https://github.com/tuanavu/airflow-tutorial/issues/52#issue-983640986 are the same fixes to the same issue.
In case @tuanavu is still around, you can probable close these two issues after updating that docker-compose file.
I'm still having this issue even though I have made the following updates:
image: puckel/docker-airflow:1.10.9
PYTHON_DEPS: sqlalchemy==1.3.0
Are those the only two things to update? I also have apache-airflow installed. I'm running docker-compose up from the terminal within VS code - is that the correct approach? Do I need to install mySQL?
I'm also facing the same issue ...I have used the docker-compose-yml file in this thread and followed the instructions under "Getting Started" . Has anyone managed to solve it
?
Upgrading docker compose worked for me. If you look at https://github.com/puckel/docker-airflow, they state that docker-compose 1.29.1 is required. I had 1.29.0, and upgraded and that fixed the problem.
I then ran into the wtforms issue, which is solved by explicitly putting wtforms 2.3.3 in the docker-compose.yml file.
I was having the same _mysql is not defined error as above so I updated the docker-compose.yml file as mentioned above. It fixed the mysql issue but another one came up...ImportError: cannot import name 'soft_unicode' from 'markupsafe', I noticed the python version running is now 3.7 instead of python3.6 from before the .yml file update. Did anyone encounter this as well and how did you fix the issue?
I have the following: Docker version 20.10.12, build e91ed57 docker-compose version 1.29.2, build 5becea4c Airflow 2.2.3
I was having the same _mysql is not defined error as above so I updated the docker-compose.yml file as mentioned above. It fixed the mysql issue but another one came up...ImportError: cannot import name 'soft_unicode' from 'markupsafe', I noticed the python version running is now 3.7 instead of python3.6 from before the .yml file update. Did anyone encounter this as well and how did you fix the issue?
I have the following: Docker version 20.10.12, build e91ed57 docker-compose version 1.29.2, build 5becea4c Airflow 2.2.3
Fo fix this issue, please add:
PYTHON_DEPS: sqlalchemy==1.3.0 markupsafe==2.0.1 wtforms==2.2
Works for me.
All the best!
I can confirm this!
Be careful to change 1.10.1 to 1.10.9 at both positions
[...]
webserver:
image: puckel/docker-airflow:1.10.9
build:
context: https://github.com/puckel/docker-airflow.git#1.10.9
dockerfile: Dockerfile
args:
AIRFLOW_DEPS: gcp_api,s3
PYTHON_DEPS: sqlalchemy==1.3.0 markupsafe==2.0.1 wtforms==2.2
[...]
Docker version 20.10.7, docker-compose version 1.29.2
Help! I'm still having a soft_unicode import error from markupsafe with Jinja2. Did a downgrade to markupsafe 2.0.1, updated the yml file but still facing the same issue.
I am getting the same error:
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.7/site-packages/markupsafe/init.py)
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 25, in
Hi, thanks for the recommendations. I have combined two cases to solve this problem after reading your instructions, you can just follow them here.
If you encountered the _mysql problem, please don't forget to download apache-airflow using the keywords "pip install apache-airflow" or depending on the terminal you're using.
After that update the docker-compose.yml file from the cloned repository.
version: '3' services: postgres: image: postgres:9.6 environment: - POSTGRES_USER=airflow - POSTGRES_PASSWORD=airflow - POSTGRES_DB=airflow ports: - "5432:5432"
webserver: image: puckel/docker-airflow:1.10.9 build: context: https://github.com/puckel/docker-airflow.git#1.10.9 dockerfile: Dockerfile args: AIRFLOW_DEPS: gcp_api,s3 PYTHON_DEPS: sqlalchemy==1.3.0 markupsafe==2.0.1 wtforms==2.2 restart: always depends_on: - postgres environment: - LOAD_EX=n - EXECUTOR=Local - FERNET_KEY=jsDPRErfv8Z_eVTnGfF8ywd19j4pyqE3NpdUBA_oRTo= volumes: - ./examples/intro-example/dags:/usr/local/airflow/dags # Uncomment to include custom plugins # - ./plugins:/usr/local/airflow/plugins ports: - "8080:8080" command: webserver healthcheck: test: ["CMD-SHELL", "[ -f /usr/local/airflow/airflow-webserver.pid ]"] interval: 30s timeout: 30s retries: 3
After this, don't forget to close the terminal first, save the .yml file and open the terminal again. Just to be sure HAHA. Then go to the folder again in the terminal. Use the command "docker-compose up -d --build" first before you use the command "docker-compose up"
It works 100%
Hi, thanks for the recommendations. I have combined two cases to solve this problem after reading your instructions, you can just follow them here.
If you encountered the _mysql problem, please don't forget to download apache-airflow using the keywords "pip install apache-airflow" or depending on the terminal you're using.
After that update the docker-compose.yml file from the cloned repository.
version: '3' services: postgres: image: postgres:9.6 environment: - POSTGRES_USER=airflow - POSTGRES_PASSWORD=airflow - POSTGRES_DB=airflow ports: - "5432:5432"
webserver: image: puckel/docker-airflow:1.10.9 build: context: https://github.com/puckel/docker-airflow.git#1.10.9 dockerfile: Dockerfile args: AIRFLOW_DEPS: gcp_api,s3 PYTHON_DEPS: sqlalchemy==1.3.0 markupsafe==2.0.1 wtforms==2.2 restart: always depends_on: - postgres environment: - LOAD_EX=n - EXECUTOR=Local - FERNET_KEY=jsDPRErfv8Z_eVTnGfF8ywd19j4pyqE3NpdUBA_oRTo= volumes: - ./examples/intro-example/dags:/usr/local/airflow/dags # Uncomment to include custom plugins # - ./plugins:/usr/local/airflow/plugins ports: - "8080:8080" command: webserver healthcheck: test: ["CMD-SHELL", "[ -f /usr/local/airflow/airflow-webserver.pid ]"] interval: 30s timeout: 30s retries: 3
After this, don't forget to close the terminal first, save the .yml file and open the terminal again. Just to be sure HAHA. Then go to the folder again in the terminal. Use the command "docker-compose up -d --build" first before you use the command "docker-compose up"
It works 100%
Worked for me, thanks, maintain the indentation.