Apache Airflow:氣流initdb導致“ImportError:沒有名為json的模塊”




python-2.7 ubuntu-16.04 (2)

在Ubuntu 16.04上使用Python 2.7默認版本,我試圖安裝Apache氣流但遇到了幾個問題,目前我看到了

apache initdb 
Traceback (most recent call last):
  File "/usr/local/bin/airflow", line 21, in <module>
    from airflow import configuration
  File "/usr/local/lib/python2.7/dist-packages/airflow/__init__.py", line 40, in <module>
    from flask_admin import BaseView
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/__init__.py", line 6, in <module>
    from .base import expose, expose_plugview, Admin, BaseView, AdminIndexView  # noqa: F401
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/base.py", line 6, in <module>
    from flask import Blueprint, current_app, render_template, abort, g, url_for
  File "/usr/local/lib/python2.7/dist-packages/flask/__init__.py", line 20, in <module>
    from .app import Flask
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 69, in <module>
    from .wrappers import Request
  File "/usr/local/lib/python2.7/dist-packages/flask/wrappers.py", line 14, in <module>
    from werkzeug.wrappers.json import JSONMixin as _JSONMixin
ImportError: No module named json

到目前為止嘗試過這些事情:


$ sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
sudo pip install -U Werkzeug==0.14.1

sudo pip install -U Jinja2==2.10.1

也試過了

pip install jsonate

pip install json # (this did not work)
 python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> exit()

到目前為止沒有任何工作。


只需升級燒瓶。 您可以使用此命令:

pip install --upgrade Flask


在Mac上安裝apache-airflow時,出現以下錯誤:

錯誤:apache-airflow 1.10.3要求jinja2 <= 2.10.0,> = 2.7.3,但你將擁有不兼容的jinja2 2.10.1。 錯誤:apache-airflow 1.10.3要求werkzeug <0.15.0,> = 0.14.1,但你會有werkzeug 0.15.4這是不相容的。

重新安裝werkzeug和jinja為我工作。

pip install jinja2>=2.10.0
pip install werkzeug>=0.15.0