私有PyPI仓库存在canpy包,但pip提示找不到适配版本求助
私有PyPI仓库pip安装失败:找不到匹配的包版本
我知道已有不少同类问题,但仍束手无策。我有一个地址类似https://pypi.my_domain.com的私有PyPI仓库,已正常使用数年。然而,运行此前可用的命令时,系统提示找不到文件,但该包明明存在于仓库中!
执行命令及错误输出
$ ./pip install --index-url https://${USERNAME}:${PASSWORD}@pypi.my_domain.com canpy Looking in indexes: https://:****@pypi.my_domain.com ERROR: Could not find a version that satisfies the requirement canpy (from versions: none) ERROR: No matching distribution found for canpy
私有PyPI仓库中的包文件
仓库内存在canpy包的以下可下载文件:
canpy-0.1.0-cp36-cp36m-linux_armv7l.whlcanpy-0.1.0.tar.gz
pip兼容版本验证
运行pip debug --verbose查看本地Python环境的兼容标签,输出结果与仓库中的包版本完全匹配,其中最后一项cp36-cp36m-linux_armv7l正是我在类树莓派设备上所需的版本。
/mnt/dataflash/miniconda3/bin/pip debug --verbose WARNING: This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice. pip version: pip 21.3.1 from /mnt/dataflash/miniconda3/lib/python3.6/site-packages/pip (python 3.6) sys.version: 3.6.6 | packaged by rpi | (default, Sep 6 2018, 10:56:14) [GCC 6.3.0 20170516] sys.executable: /mnt/dataflash/miniconda3/bin/python sys.getdefaultencoding: utf-8 sys.getfilesystemencoding: ascii locale.getpreferredencoding: ANSI_X3.4-1968 sys.platform: linux sys.implementation: name: cpython 'cert' config value: Not specified REQUESTS_CA_BUNDLE: None CURL_CA_BUNDLE: None pip._vendor.certifi.where(): /mnt/dataflash/miniconda3/lib/python3.6/site-packages/pip/_vendor/certifi/cacert.pem pip._vendor.DEBUNDLED: False vendored library versions: CacheControl==0.12.6 colorama==0.4.4 distlib==0.3.3 distro==1.6.0 html5lib==1.1 msgpack==1.0.2 (Unable to locate actual module version, using vendor.txt specified version) packaging==21.0 pep517==0.12.0 platformdirs==2.4.0 progress==1.6 pyparsing==2.4.7 requests==2.26.0 certifi==2021.05.30 chardet==4.0.0 idna==3.2 urllib3==1.26.7 resolvelib==0.8.0 setuptools==44.0.0 (Unable to locate actual module version, using vendor.txt specified version) six==1.16.0 tenacity==8.0.1 (Unable to locate actual module version, using vendor.txt specified version) tomli==1.0.3 webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version) Compatible tags: 174 cp36-cp36m-manylinux_2_25_armv7l cp36-cp36m-manylinux_2_24_armv7l cp36-cp36m-manylinux_2_23_armv7l cp36-cp36m-manylinux_2_22_armv7l cp36-cp36m-manylinux_2_21_armv7l cp36-cp36m-manylinux_2_20_armv7l cp36-cp36m-manylinux_2_19_armv7l cp36-cp36m-manylinux_2_18_armv7l cp36-cp36m-manylinux_2_17_armv7l cp36-cp36m-manylinux2014_armv7l cp36-cp36m-linux_armv7l ...
注意:该操作此前多次成功,今日突然失效……
排查方案
- 验证身份变量解析:从命令输出可见索引地址中的用户名为空(
https://:****@pypi.my_domain.com),说明${USERNAME}变量未正确解析。手动替换为实际用户名密码重试:./pip install --index-url https://实际用户名:实际密码@pypi.my_domain.com canpy - 检查仓库服务可用性:用curl验证仓库是否正常响应包索引请求:
若返回404或认证错误,说明仓库端存在问题。curl -u 用户名:密码 https://pypi.my_domain.com/simple/canpy/ - 清理pip缓存:pip可能缓存了旧索引信息,清理后重新安装:
./pip cache purge ./pip install --index-url https://${USERNAME}:${PASSWORD}@pypi.my_domain.com canpy - 指定具体版本安装:明确指定仓库中存在的版本,避免自动解析问题:
./pip install --index-url https://${USERNAME}:${PASSWORD}@pypi.my_domain.com canpy==0.1.0 - 检查全局pip配置:查看是否有全局配置覆盖了索引地址:
若存在./pip config listglobal.index-url等冲突配置,可临时用--no-config参数跳过:./pip install --no-config --index-url https://${USERNAME}:${PASSWORD}@pypi.my_domain.com canpy
内容的提问来源于stack exchange,提问作者Sean McCarthy
相关产品推荐
相关产品推荐

