Jacob Thompson
Jacob Thompson

Reputation: 411

Cannot run apache airflow after fresh install, python import error

after a fresh install using pip install apache-airflow, any attempts to run airflow end with a python import error:

Traceback (most recent call last):
File "/Users/\*/env/bin/airflow", line 26, in <module> from airflow.bin.cli import CLIFactory
File "/Users/\*/env/lib/python3.7/site-packages/airflow/bin/cli.py", line 70, in <module> from airflow.www.app import (cached_app, create_app)
File "/Users/\*/env/lib/python3.7/site-packages/airflow/www/app.py", line 26, in <module> from flask_wtf.csrf import CSRFProtect
File "/Users/\*/env/lib/python3.7/site-packages/flask_wtf/__init__.py", line 17, in <module> from .recaptcha import \*
File "/Users/\*/env/lib/python3.7/site-packages/flask_wtf/recaptcha/__init__.py", line 2, in <module> from .fields import \*
File "/Users/\*/env/lib/python3.7/site-packages/flask_wtf/recaptcha/fields.py", line 3, in <module> from . import widgets
File "/Users/\*/env/lib/python3.7/site-packages/flask_wtf/recaptcha/widgets.py", line 5, in <module> from werkzeug import url_encode
ImportError: cannot import name 'url_encode' from 'werkzeug' (/Users/*/env/lib/python3.7/site-packages/werkzeug/__init__.py)

Upvotes: 18

Views: 4942

Answers (2)

kaxil
kaxil

Reputation: 18884

We have fixed it in Airflow 1.10.9, please install the latest version:

pip install -U apache-airflow

or pin Werkzeug by running pip install werkzeug<1.0

Upvotes: 2

Jacob Thompson
Jacob Thompson

Reputation: 411

It seemed to be a versioning error, the newer versions of the werkzeug package no longer have the url_encode that airflow is looking for, installing a lower version (pip install werkzeug==0.16.0) resolved the issue and airflow now runs without failing.

Upvotes: 23

Related Questions