python - 从 Azure DevOps Python Artifacts feed 进行 pip 安装不起作用

标签 python azure pip azure-devops azure-artifacts

当我尝试从 Azure DevOps Artifacts feed 安装包时,出现错误:

Looking in indexes: https://pypi.org/simple, https://pkgs.dev.azure.com/company/company_Software/_packaging/PyPI/pypi/simple/
ERROR: Could not find a version that satisfies the requirement as-api (from versions: none)
ERROR: No matching distribution found for as-api

由于使用 pip install -vvv 可能会产生 secret 信息,因此我无法在此处提供完整日志。请随时询问有关日志的任何具体问题。与此同时,我可以看到有希望的消息,例如:

Found index url https://pkgs.dev.azure.com/company/company_Software/_packaging/PyPI/pypi/simple/
Getting credentials from keyring for https://pkgs.dev.azure.com/company/company_Software/_packaging/PyPI/pypi/simple/

还有一些有问题的消息?:

Status code 302 not in (200, 203, 300, 301)
Skipping link: not a file: ...
Given no hashes to check 0 links for project 'as-api': discarding no candidates

复制详细信息

virtualenv .venv
.\.venv\Scripts\activate
python -m pip install -U pip
pip install keyring artifacts-keyring
pip install as-api

这个link用于生成发布包的管道以及安装包的建议方法。我的方法现在是选项 1 和选项 2 的混合。请注意使用 php.ini 文件来设置 --index-urlartifacts-keyring 包(使用 --pre 安装对版本没有任何影响),所以它确实没有任何区别。但是,我分别尝试了这两个选项,它不会生成浏览器,因此给出了相同的结果。

系统详细信息:

  • 操作系统:Windows 10
  • Python 2.7.17
pip list
Package           Version
----------------- ----------
artifacts-keyring 0.2.8rc0
certifi           2019.11.28
chardet           3.0.4
configparser      4.0.2
entrypoints       0.3
idna              2.8
keyring           18.0.1
pip               19.3.1
pywin32-ctypes    0.2.0
requests          2.22.0
setuptools        42.0.2
urllib3           1.25.7
wheel             0.33.6

文件夹结构:

test
  |-- test.py
  |-- .venv
         |-- pip.ini
         |-- ... other virtualenv folders and files

pip.ini:

[global]
extra-index-url = https://pkgs.dev.azure.com/company/company_Software/_packaging/PyPI/pypi/simple/

进一步分析

  • 使用干净的笔记本电脑实际上可以处理上述再现细节。公司其他电脑也有同样的问题,所以我们的一些设置与身份验证有冲突。

  • 如果我们使用管道(请参阅此 link )来安装 as-api 包,它会起作用,所以我怀疑这是一个身份验证问题,但在任何文档。

  • 使用https://username:password@ ...即使用户名和密码错误,也不会给出任何身份验证错误。

  • 使用正确的用户名但密码中包含符号会触发交互模式输入用户名和密码。但是,这会出现此错误:警告:401错误,https://pkgs.dev.azure.com/company/company_Software/_packaging/PyPI/pypi/simple/as-api/的凭据不正确 请注意,我是 Artifacts feed 的所有者,并且该团队已在权限选项卡中添加为所有者。

最佳答案

As a workaround:

看起来您正在使用 option2来自the document进行安装。我碰巧看到一个similar issue这表明此错误消息可能与 pip.ini(windows) 或 pip.conf(linux/mac) 有关,所以我认为您可以尝试另一种方法避免这些配置出现问题。

您可以运行pip install artifacts-keyring --pre,然后运行

pip install packageName --index-url https://pkgs.dev.azure.com/xxx/xxx/_packaging/xxx/pypi/simple/ -vvv --no-deps

运行命令pip install artifacts-keyring --pre时,您会遇到类似的情况:

enter image description here

登录通过后,如果您的 Feed 中存在所需的包,您将获得该包。

关于python - 从 Azure DevOps Python Artifacts feed 进行 pip 安装不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59459055/

相关文章:

c++ - 用于从 Python 测量外部 .exe 运行时的更准确的计时器?

python - 无法启动jupyter笔记本

python - 以复数矩阵作为初始值求解 python 中的 ode

azure - 如何为开发人员提供通过 p2s vpn 访问 Azure-sql 服务器的权限

python - 无法验证这些要求的哈希值,因为我们没有办法对版本控制存储库进行哈希处理

python 的 re : replace regex to regex

excel - 将Excel变量解析到powershell中

azure - CosmosDB 更改源、租约和 azure 函数

python-3.x - 在 Raspberry pi 3 上安装 PyAudio 失败并出现 gcc 错误

python - 无法通过 pip 在 Python 上安装 pygame (Windows 10)