pip 在 Artifactory 中找不到 PyPI 包

Pip can't find PyPI package in Artifactory

我构建了 PyPI 包并使用 jfrog CLI 和命令推送到我们的本地 Artifactory:

tar.gz

./jfrog rt upload --url https://artifacts.XYZ.com/artifactory '--props=pypi.name=xyz_easysdlc.traceability_matrix_generator;pypi.version=0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop;pypi.normalized.name=xyz-easysdlc-traceability-matrix-generator' --module=xyz_easysdlc.traceability_matrix_generator --user=**** '--password=****' dist/xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop.tar.gz pypi-main-dev/xyz_easysdlc.traceability_matrix_generator/0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop/

车轮

./jfrog rt upload --url https://artifacts.xyz.com/artifactory '--props=pypi.name=xyz_easysdlc.traceability_matrix_generator;pypi.version=0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop;pypi.normalized.name=xyz-easysdlc-traceability-matrix-generator' --module=xyz_easysdlc.traceability_matrix_generator --user=**** '--password=****' dist/xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop-py3-none-any.whl pypi-main-dev/xyz_easysdlc.traceability_matrix_generator/0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop/

两个都上传成功。

当我按照以下步骤从 .whl 文件安装 pip 包时,它有效:

  1. 下载https://artifacts.xyz.com/artifactory/webapp/#/artifacts/browse/tree/PyPIInfo/pypi-main-dev-local/xyz_easysdlc.traceability_matrix_generator/0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop/xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop-py3-none-any.whl
  2. 运行 pip install ~/Downloads/xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop-py3-none-any.whl

然后我会期望,那只是

pip install --pre --index-url https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple xyz_easysdlc.traceability_matrix_generator

可以,但出现以下错误:

ERROR: Could not find a version that satisfies the requirement xyz_easysdlc.traceability_matrix_generator (from versions: none)
ERROR: No matching distribution found for xyz_easysdlc.traceability_matrix_generator

伙计们,有什么猜想吗?

[更新] 当我 运行 在详细模式下安装 pip 时,我得到以下输出:

Created temporary directory: /private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-ephem-wheel-cache-u7ai32js
Created temporary directory: /private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-req-tracker-rxb7443i
Created requirements tracker '/private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-req-tracker-rxb7443i'
Created temporary directory: /private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-install-kegd0en3
Looking in indexes: https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple
1 location(s) to search for versions of xyz-easysdlc.traceability-matrix-generator:
* https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/
Getting page https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/
Found index url https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple
Looking up "https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): artifacts.xyz.com:443
https://artifacts.xyz.com:443 "GET /artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/ HTTP/1.1" 404 None
Status code 404 not in (200, 203, 300, 301)
Could not fetch URL https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/: 404 Client Error: Not Found for url: https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/ - skipping
Given no hashes to check 0 links for project 'xyz-easysdlc.traceability-matrix-generator': discarding no candidates
ERROR: Could not find a version that satisfies the requirement xyz_easysdlc.traceability_matrix_generator (from versions: none)
Cleaning up...
Removed build tracker '/private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-req-tracker-rxb7443i'
ERROR: No matching distribution found for xyz_easysdlc.traceability_matrix_generator
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 382, in run
    resolver.resolve(requirement_set)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 311, in _get_abstract_dist_for
    req.populate_link(self.finder, upgrade_allowed, self.require_hashes)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 225, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/index.py", line 906, in find_requirement
    'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for xyz_easysdlc.traceability_matrix_generator

但是当我导航到 https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/ 时,我可以同时看到 *.whl 和 *.tar.gz 文件。只是为了确定,这不是一些 "invalid" 包名称的问题,这里是文件名。

xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop-py3-none-any.whl
xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop.tar.gz

我找到了这个问题的根本原因。即使您未获得授权,Artifactory 也会发送 HTTP 代码 404 (v. 6.10.7)。当我为 pip install 进行身份验证时,安装成功。