'Airflow Installation issue| setproctitle

I Have followed the below steps for airflow installation and have successfully installed but am unable to run any commands which start with airflow, even to check the version. Any help is appreciated.

python3.9 -m venv airflowenv ,
source airflowenv/bin/activate export , AIRFLOW_HOME=~/airflow , echo $AIRFLOW_HOME ,

pip install --upgrade pip , pip install apache-airflow==1.10.15 , airflow initdb.

This is the error am receiving:

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
*********************************************************************


Solution 1:[1]

If you are on MacOS, you need to install Python 3.8 manually following https://www.python.org/downloads/.

See Import issue for setproctitle on Mac OS,

Solution 2:[2]

You should use constraints when installing Airflow. See this link that explains why: https://airflow.apache.org/docs/apache-airflow/stable/installation.html#constraints-files

In your case, the correct command will be:

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jarek Potiuk
Solution 2 Jarek Potiuk