气流安装问题|设置标题

Airflow Installation issue| setproctitle

我已按照以下步骤安装 airflow 并已成功安装,但无法 运行 任何以 airflow 开头的命令,甚至无法检查版本。感谢任何帮助。

python3.9 -m venv airflowenv ,
来源 airflowenv/bin/activate 导出 , AIRFLOW_HOME=~/气流, 回声 $AIRFLOW_HOME ,

pip 安装 --upgrade pip , pip 安装 apache-airflow==1.10.15 , 气流 initdb.

这是我收到的错误:

Traceback (most recent call last):
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/bin/airflow", line 25, in <module>
    from airflow.configuration import conf
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/__init__.py", line 50, in <module>
    from airflow.models import DAG  # noqa: E402
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/models/__init__.py", line 21, in <module>
    from airflow.models.baseoperator import BaseOperator, BaseOperatorLink  # noqa: F401
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 43, in <module>
    from airflow.models.dag import DAG
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/models/dag.py", line 47, in <module>
    from airflow.executors import LocalExecutor, get_default_executor
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/executors/__init__.py", line 23, in <module>
    from airflow.executors.base_executor import BaseExecutor # noqa
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/executors/base_executor.py", line 24, in <module>
    import airflow.utils.dag_processing
  File "/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/airflow/utils/dag_processing.py", line 40, in <module>
    from setproctitle import setproctitle
ImportError: dlopen(/Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/setproctitle.cpython-38-darwin.so, 2): Symbol not found: _Py_GetArgcArgv
  Referenced from: /Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/setproctitle.cpython-38-darwin.so
  Expected in: flat namespace
 in /Users/user_name/Documents/python_learning/airflow/airflowenv/lib/python3.8/site-packages/setproctitle.cpython-38-darwin.so```

---------------------------------------------------------------------*********************************************************************
SOLUTION:[Followed these steps to fix the issue]:
Install python3.9 from the python website
python3.9 -m venv envpython
source envpython/bin/activate
export AIRFLOW_HOME=~/airflow
echo $AIRFLOW_HOME
pip install apache-airflow==1.10.15 --constraint https://raw.githubusercontent.com/apache/airflow/constraints-1.10.15/constraints-3.8.txt
airflow initdb
airflow webserver
airflow scheduler
*********************************************************************

您应该在安装 Airflow 时使用约束。请参阅此 link 解释原因:https://airflow.apache.org/docs/apache-airflow/stable/installation.html#constraints-files

在您的情况下,正确的命令是:

pip install apache-airflow==1.10.15 --constraint https://raw.githubusercontent.com/apache/airflow/constraints-1.10.15/constraints-3.8.txt

如果您使用的是 MacOS,则需要按照 https://www.python.org/downloads/.

手动安装 Python 3.8