apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.15k stars 14.32k forks source link

BROKEN DAG : AttributeError: module 'sqlalchemy.util.compat' has no attribute 'TYPE_CHECKING' #18500

Closed KevinJoaquim closed 3 years ago

KevinJoaquim commented 3 years ago

Apache Airflow version

2.1.2

Operating System

Linux python3.6 venv

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

What happened

Hello team,

I have an import UI problem with a Dag :

Capture du 2021-09-24 13-40-37

But I have no errors logs, the dag is visible and running.. I tried to refresh the Dag, reinstall Flask-SQLAlchemy and SQLAlchemy..

This error appears and then disappears approximately every 5 minutes

Versions: airflow : v2.1.2 SQLAlchemy : 1.3.24 Flask-SQLAlchemy : 2.4.0

Anyone know how to fix this problem?

thanks in advance, Kevin

What you expected to happen

No response

How to reproduce

No response

Anything else

No response

Are you willing to submit PR?

Code of Conduct

boring-cyborg[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the issue template!

fmilagres commented 3 years ago

Hello @KevinJoaquim,

Could you send part of your code? DAG code and everything else.

KevinJoaquim commented 3 years ago

Hello @fmilagres Here is the code of a dag with the same error:

`from datetime import datetime, timedelta, date

from airflow import DAG from airflow.utils import dates from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from airflow.providers.http.operators.http import SimpleHttpOperator from airflow.operators.dummy_operator import DummyOperator from airflow.models import Variable

default_args = { 'owner': 'QUICK_FACTORY', 'depends_on_past': False, 'start_date': datetime.utcnow(), 'retries': 1, 'retry_delay': timedelta(minutes=1) }

dag = DAG('APP3099.QFA.C.Maj_Base_Alarm_Isis.001', default_args=default_args, schedule_interval='/3 *')

t1 = SimpleHttpOperator( task_id='HTTP_maj_alarm', http_conn_id='3099_alarm_maj', endpoint='home.php', method='GET', log_response=True, dag=dag )`

And my pip list :

pip list Package Version


-QLAlchemy 1.2.19
airflow-fs 0.1.0
alembic 1.2.1
amqp 2.6.1
anyio 3.3.1
apache-airflow 2.1.2
apache-airflow-providers-amazon 2.2.0
apache-airflow-providers-cncf-kubernetes 2.0.2
apache-airflow-providers-ftp 2.0.0
apache-airflow-providers-http 2.0.0
apache-airflow-providers-imap 2.0.0
apache-airflow-providers-microsoft-winrm 2.0.0
apache-airflow-providers-oracle 2.0.0
apache-airflow-providers-postgres 2.0.0
apache-airflow-providers-sftp 2.0.0
apache-airflow-providers-sqlite 2.0.0
apache-airflow-providers-ssh 2.0.0
apispec 3.3.0
argcomplete 1.11.1
asn1crypto 0.24.0
async-generator 1.10
attrs 20.3.0
Babel 2.7.0
bcrypt 3.1.7
billiard 3.6.4.0
blinker 1.4
boto3 1.17.112 botocore 1.20.112 cached-property 1.5.1
cachetools 3.1.1
cattrs 1.0.0
celery 4.4.0
celery-exporter 1.5.1
certifi 2019.6.16 cffi 1.12.3
chardet 3.0.4
charset-normalizer 2.0.4
Click 7.0
click-didyoumean 0.0.3
click-plugins 1.1.1
click-repl 0.2.0
clickclick 20.10.2
colorama 0.4.1
colorlog 4.0.2
commonmark 0.9.1
configparser 3.5.3
contextvars 2.4
croniter 0.3.30
crypto 1.4.1
cryptography 2.7
cx-Oracle 8.1.0
dataclasses 0.8
decorator 5.0.9
defusedxml 0.6.0
dill 0.2.9
dnspython 2.0.0
docutils 0.14
dumb-init 1.2.2
elasticsearch 5.5.3
elasticsearch-dsl 5.4.0
email-validator 1.1.1
Flask 1.1.1
Flask-Admin 1.5.4
Flask-AppBuilder 3.3.0
Flask-Babel 1.0.0
Flask-Bcrypt 0.7.1
Flask-Caching 1.5.0
Flask-JWT-Extended 3.23.0
Flask-Login 0.4.1
Flask-OpenID 1.3.0
Flask-SQLAlchemy 2.5.1
flask-swagger 0.2.13
Flask-WTF 0.14.3
flower 0.9.5
funcsigs 1.0.0
future 0.16.0
futures 3.1.1
gitdb2 2.0.5
GitPython 2.1.11
google-auth 1.6.3
graphviz 0.13.2
gunicorn 19.9.0
h11 0.12.0
httpcore 0.13.6
httpx 0.19.0
humanize 3.11.0
idna 2.8
immutables 0.16
importlib-metadata 1.7.0
importlib-resources 1.5.0
inflection 0.5.1
iso8601 0.1.12
isodate 0.6.0
itsdangerous 1.1.0
Jinja2 2.10.3
jmespath 0.9.4
json-merge-patch 0.2
jsonpath-ng 1.5.3
jsonschema 3.0.2
kombu 4.6.11
kubernetes 11.0.0
lazy-object-proxy 1.4.2
ldap3 2.6
lockfile 0.12.2
lxml 4.3.4
Mako 1.0.12
Markdown 2.6.11
MarkupSafe 1.1.1
marshmallow 3.0.0
marshmallow-enum 1.5.1
marshmallow-oneofschema 3.0.1
marshmallow-sqlalchemy 0.23.1
more-itertools 8.1.0
Naked 0.1.31
ntlm-auth 1.5.0
numpy 1.16.4
oauthlib 3.1.0
openapi-schema-validator 0.1.5
openapi-spec-validator 0.3.1
ordereddict 1.1
packaging 20.9
pandas 0.24.2
paramiko 2.7.1
pendulum 2.1.2
pep562 1.0
pip 19.1.1
ply 3.11
postgres 2.2.2
prison 0.1.3
prometheus-client 0.8.0
prompt-toolkit 3.0.20
psutil 5.6.3
psycopg2-binary 2.8.3
pyasn1 0.4.7
pyasn1-modules 0.2.6
pycparser 2.19
Pygments 2.4.2
PyJWT 1.7.1
pymssql 2.1.4
PyNaCl 1.3.0
pyparsing 2.4.7
pyrsistent 0.15.4
pysftp 0.2.9
python-daemon 2.2.4
python-dateutil 2.8.0
python-editor 1.0.4
python-nvd3 0.15.0
python-slugify 4.0.1
python3-openid 3.2.0
pytz 2019.1
pytzdata 2020.1
pywinrm 0.4.1
PyYAML 5.1.1
rabbitmq 0.2.0
redis 3.2.1
requests 2.24.0
requests-ntlm 1.1.0
requests-oauthlib 1.2.0
rfc3986 1.5.0
rich 10.9.0
rsa 4.0
s3transfer 0.4.2
setproctitle 1.1.10
setuptools 36.5.0
shellescape 3.4.1
six 1.12.0
smmap2 2.0.5
sniffio 1.2.0
SQLAlchemy 1.3.24
SQLAlchemy-JSONField 1.0.0
SQLAlchemy-Utils 0.36.1
sshtunnel 0.1.5
statsd 3.3.0
swagger-ui-bundle 0.0.8
tabulate 0.8.3
tenacity 6.2.0
termcolor 1.1.0
text-unidecode 1.3
thrift 0.11.0
tornado 5.1.1
typing 3.7.4.1
typing-extensions 3.7.4.1
tzlocal 1.5.1
unicodecsv 0.14.1
urllib3 1.25.11
vine 1.3.0
watchtower 1.0.6
wcwidth 0.2.5
web.py 0.40.dev1 websocket-client 0.56.0
Werkzeug 1.0.1
WTForms 2.2.1
xmltodict 0.12.0
zipp 1.0.0
zope.deprecation 4.4.0

For information, I have 700 functional Dags with only 5 import errors

potiuk commented 3 years ago
-QLAlchemy 1.2.19

This is likely your problem. For some reason you have a bogus package imstalled which replaces your sqlachemy.

I am not sure what the package is, but it could be that you are the victim of "typosquatting" attack (https://nakedsecurity.sophos.com/2017/09/19/pypi-python-repository-hit-by-typosquatting-sneak-attack/). Some time ago published packages in PIP which were different by only one letter (hoping that someone will install them when they made a typo)

Some people also had this package installed, so the above is likely: https://github.com/bndr/pipreqs/issues/206

I convert it into discussion as it is not Airflow issue most likely