Windows环境安装apache-airflow失败,卡在pendulum环节求助
问题:Windows下VSCode安装Apache Airflow时卡在pendulum环节,无法获取poetry-core
环境信息
- 系统:Windows
- 编辑器:VSCode
- Python版本:3.11.1
- pip版本:23.0.1
安装命令
pip --proxy 'proxy address' install apache-airflow
错误详情
安装流程卡在pendulum包的安装环节,出现连接pypi.org超时,最终提示无法找到满足要求的poetry-core>=1.0.0a9版本,完整错误日志如下:
Collecting apache-airflow Using cached apache_airflow-2.5.1-py3-none-any.whl (11.8 MB) Collecting alembic<2.0,>=1.6.3 Using cached alembic-1.9.4-py3-none-any.whl (210 kB) Collecting argcomplete>=1.10 Using cached argcomplete-2.0.0-py2.py3-none-any.whl (37 kB) Collecting attrs>=22.1.0 Using cached attrs-22.2.0-py3-none-any.whl (60 kB) Collecting blinker Using cached blinker-1.5-py2.py3-none-any.whl (12 kB) Collecting cattrs>=22.1.0 Using cached cattrs-22.2.0-py3-none-any.whl (35 kB) Collecting colorlog<5.0,>=4.0.2 Using cached colorlog-4.8.0-py2.py3-none-any.whl (10 kB) Collecting configupdater>=3.1.1 Using cached ConfigUpdater-3.1.1-py2.py3-none-any.whl (34 kB) Collecting connexion[flask]>=2.10.0 Using cached connexion-2.14.2-py2.py3-none-any.whl (95 kB) Collecting cron-descriptor>=1.2.24 Using cached cron_descriptor-1.2.35.tar.gz (29 kB) Preparing metadata (setup.py) ... done Collecting croniter>=0.3.17 Using cached croniter-1.3.8-py2.py3-none-any.whl (18 kB) Requirement already satisfied: cryptography>=0.9.3 in c:\users\username\desktop\airflow_tutorial\airflow_env\lib\site-packages (from apache-airflow) (39.0.1) Collecting deprecated>=1.2.13 Using cached Deprecated-1.2.13-py2.py3-none-any.whl (9.6 kB) Collecting dill>=0.2.2 Using cached dill-0.3.6-py3-none-any.whl (110 kB) Collecting flask<2.3,>=2.2 Using cached Flask-2.2.3-py3-none-any.whl (101 kB) Collecting flask-appbuilder==4.1.4 Using cached Flask_AppBuilder-4.1.4-py3-none-any.whl (1.8 MB) Collecting flask-caching>=1.5.0 Using cached Flask_Caching-2.0.2-py3-none-any.whl (28 kB) Collecting flask-login>=0.6.2 Using cached Flask_Login-0.6.2-py3-none-any.whl (17 kB) Collecting flask-session>=0.4.0 Using cached Flask_Session-0.4.0-py2.py3-none-any.whl (7.5 kB) Collecting flask-wtf>=0.15 Using cached Flask_WTF-1.1.1-py3-none-any.whl (12 kB) Collecting graphviz>=0.12 Using cached graphviz-0.20.1-py3-none-any.whl (47 kB) Collecting gunicorn>=20.1.0 Using cached gunicorn-20.1.0-py3-none-any.whl (79 kB) Collecting httpx Using cached httpx-0.23.3-py3-none-any.whl (71 kB) Collecting itsdangerous>=2.0 Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB) Collecting jinja2>=3.0.0 Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB) Collecting jsonschema>=3.2.0 Using cached jsonschema-4.17.3-py3-none-any.whl (90 kB) Collecting lazy-object-proxy Using cached lazy_object_proxy-1.9.0-cp311-cp311-win_amd64.whl (22 kB) Collecting linkify-it-py>=2.0.0 Using cached linkify_it_py-2.0.0-py3-none-any.whl (19 kB) Collecting lockfile>=0.12.2 Using cached lockfile-0.12.2-py2.py3-none-any.whl (13 kB) Collecting markdown>=3.0 Using cached Markdown-3.4.1-py3-none-any.whl (93 kB) Collecting markdown-it-py>=2.1.0 Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB) Collecting markupsafe>=1.1.1 Using cached MarkupSafe-2.1.2-cp311-cp311-win_amd64.whl (16 kB) Collecting marshmallow-oneofschema>=2.0.1 Using cached marshmallow_oneofschema-3.0.1-py2.py3-none-any.whl (5.8 kB) Collecting mdit-py-plugins>=0.3.0 Using cached mdit_py_plugins-0.3.4-py3-none-any.whl (52 kB) Collecting packaging>=14.0 Using cached packaging-23.0-py3-none-any.whl (42 kB) Collecting pathspec~=0.9.0 Using cached pathspec-0.9.0-py2.py3-none-any.whl (31 kB) Collecting pendulum>=2.0 Using cached pendulum-2.1.2.tar.gz (81 kB) Installing build dependencies ... error error: subprocess-exited-with-error × pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [7 lines of output] WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002118C9114D0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/poetry-core/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002118C912210>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/poetry-core/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002118C912ED0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/poetry-core/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002118C913A50>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/poetry-core/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002118C ERROR: Could not find a version that satisfies the requirement poetry-core>=1.0.0a9 (from versions: none) ERROR: No matching distribution found for poetry-core>=1.0.0a9 note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
解决方法
1. 手动预安装poetry-core
pip安装pendulum时会启动子进程安装构建依赖,但代理参数可能没传递给子进程,先手动安装所需的poetry-core:
pip --proxy 'proxy address' install poetry-core>=1.0.0a9
安装完成后再重新执行Airflow的安装命令。
2. 切换国内PyPI镜像源
若代理连接pypi.org持续超时,改用国内镜像源(如阿里云)加速安装:
pip --proxy 'proxy address' install apache-airflow -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
无需代理的话,去掉--proxy参数即可。
3. 设置全局代理环境变量
将代理配置为系统环境变量,确保子进程也能继承代理设置:
- 在CMD中执行:
set HTTP_PROXY=proxy address set HTTPS_PROXY=proxy address
- 之后在同一窗口执行Airflow安装命令:
pip install apache-airflow
4. 降低Python版本兼容性
Airflow 2.5.1对Python 3.11的支持存在部分兼容性问题,可尝试降级到Python 3.10后重新安装。
内容的提问来源于stack exchange,提问作者sk8
相关产品推荐
相关产品推荐

