简体   繁体   中英

pip cannot find package from local pypi (jfrog artifactory)

We have a local pypi in which we put some python packages. However, pip is unable to install the package.

pip search will find the package:

$ pip search --index=http://artifactory.ours.com/api/pypi/pypi-local/simple hello        
hello     - UNKNOWN

But pip install gives the following:

pip install --pre -r requirements.txt --trusted-host=artifactory.ours.com

Collecting hello (from -r requirements.txt (line 4)) Could not find a version that satisfies the requirement hello (from -r requirements.txt (line 4)) (from versions: ) No matching distribution found for hello (from -r requirements.txt (line 4))

and here is the requirements.txt:

# requirements.txt
--allow-all-external
--extra-index-url http://artifactory.ours.com/artifactory/api/pypi/pypi-local/simple

hello

I believe the issue is that your package does not have a version number. Your setup.py does not specify the version.

Example from the Python documents (the example is for distutils):

https://docs.python.org/2/distutils/setupscript.html

So the problem seems to be lifted if I use an older version of pip like 1.x . Not sure if this is jfrog bug or related to pip itself.

Another possible cause for this issue is when you use hyphen(-) in the name of the package while uploading it to artifactory. pip can successfully search and find your package but it cannot install it. Replace the hyphen with underscore.

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