pip安装snowflake-connector-python==2.3.6失败,如何排查这类问题?
- 核对pip源状态
执行pip config list查看当前配置的pip源,国内镜像源存在同步延迟、资源缺失的概率更高,可临时切换官方源重试安装:pip install -r requirements.txt -i https://pypi.org/simple - 验证版本兼容性
执行python --version确认当前Python版本,核对目标依赖版本的Python适配范围,你遇到的snowflake-connector-python==2.3.6要求Python>=3.5,若你使用的Python版本过高(如3.10+),旧版本包未适配也会触发匹配失败。直接不指定版本安装成功说明最新版本适配你的环境,可先临时替换为兼容版本,再逐步排查版本适配问题。 - 补全构建环境依赖
从报错日志可以看到,2.3.6版本的源码包被丢弃的直接原因是构建依赖安装失败,可先手动安装对应构建前置依赖后重试:pip install setuptools>=40.6.0 wheel cython 'pyarrow>=0.17.0,<0.18.0' - 强制使用预编译包安装
部分旧版本包没有对应你系统架构的预编译wheel包,本地编译缺少依赖就会失败,可添加参数强制走预编译包安装:pip install snowflake-connector-python==2.3.6 --only-binary :all: - 隔离环境测试
执行pip check排查当前环境是否存在依赖冲突,也可以新建虚拟环境做隔离安装测试,排除现有环境的依赖干扰。
报错核心信息参考:
WARNING: Discarding https://files.pythonhosted.org/packages/09/39/65b33cf8ea5a1a6ecc213b8beba65f3860440bd5c4a8c5636e2b8d23afa9/snowflake-connector-python-2.3.6.tar.gz#sha256=1a4ebf25989fc13d6f70dc3e2064721c54834e493a7964a1d67be61d40e75f50 (from https://pypi.org/simple/snowflake-connector-python/) (requires-python:>=3.5). Command errored out with exit status 1: /Users/willwright/miniconda3/bin/python /private/var/folders/c8/9c921tr17gdbjsfbrw4hlgtr0000gn/T/pip-standalone-pip-12vdp_4t/env_pip.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/c8/9c921tr17gdbjsfbrw4hlgtr0000gn/T/pip-build-env-8eydzsmj/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel cython 'pyarrow>=0.17.0,<0.18.0' Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement snowflake-connector-python2.3.6 (from versions: 1.3.17, 1.3.18, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.6.12, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.9.1, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.3.10, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.5.0, 2.5.1)
ERROR: No matching distribution found for snowflake-connector-python2.3.6

内容的提问来源于stack exchange,提问作者willwrighteng

