全新安装后无法运行apache气流,python导入错误


19

在使用进行全新安装后pip install apache-airflow,任何运行气流的尝试都会以python导入错误结束:

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)

看起来我今天也遇到了同样的问题,并且想知道我的代码没有重大变化,我认为这将引发这种类型的错误
alltej

三天前,我在实例上安装了气流,并且工作正常。我安装了它的另一个实例类似的方式......它会引发同样的错误..
Anidhya纳加尔

Answers:


23

这似乎是版本控制错误,werkzeug软件包的较新版本不再具有airflow正在寻找的url_encode,安装较低版本(pip install werkzeug==0.16.0)可解决问题,并且airflow 现在可以正常运行。


1
是的,使用werkzeug 1.0(包含在Flask中)也给了我同样的错误,回到0.16.0修复了它
Matty

1
好一个@雅各布!如果您想获得潜在的补丁更新,请改用pip install werkzeug==0.16.*...
Enrico M.

1
太棒了,@ Jacob的答案节省了我很多时间,否则我将最终像以前一样进行调试。
Anidhya Bhatnagar

0

我们已经在Airflow 1.10.9中修复了它,请安装最新版本:

pip install -U apache-airflow

或通过运行将Werkzeug固定 pip install werkzeug<1.0

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.