简体   繁体   中英

Pip can't find PyPI package in Artifactory

I build the PyPI package and pushed to our on-prem Artifactory by using jfrog CLI and command:

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/

wheel

./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/

Both are uploaded successfully.

When I'm installing the pip package from .whl file by following steps, it works:

  1. Download 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. Run pip install ~/Downloads/xyz_easysdlc.traceability_matrix_generator-0.0.1.dev20200102111901+dirty.0.g251f725.mock.develop-py3-none-any.whl

I would then expect, that simply

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

would work, but I'm getting following error:

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

Any guess, guys?

[UPDATE] When I run pip install in verbose mode, I'm getting following output:

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

But when I navigate to https://artifacts.xyz.com/artifactory/api/pypi/pypi-main-dev/simple/xyz-easysdlc-traceability-matrix-generator/ I can see both, *.whl and *.tar.gz files. Just to make sure, it's not an issue with some "invalid" package name, here are the names of files.

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

I found the root cause of this issue. Artifactory is sending HTTP Code 404 even in case you are not authorized (v. 6.10.7). When I authenticated for pip install , installation was successful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM