5
votes

While testing out conan, I had to "pip install" it.

As I am working in a fully offline environment, my expectation was that I could simply

This works fine for some packages and then fails for the dependency on patch == 1.16

[...]
Collecting patch==1.16 (from conan)
  Could not find a version that satisfies the requirement patch==1.16 (from conan) (from versions: )
No matching distribution found for patch==1.16 (from conan)

Looking into the Artifactory logs, this shows that even though I manually deployed patch-1.16.zip (from https://pypi.org/project/patch/1.16/#files) into the repository, it is not present in the index...

  • The .pypi/simple.html file doesn't contain an entry for 'patch' (checked from the Artifactory UI)
  • The server logs ($ARTIFACTORY_HOME/logs/artifactory.log) show the file being added to the indexing queue but don't contain a line saying that it got indexed

Does anyone know why patch-1.16.zip is not indexed by Artifactory?

This is on Artifactory 5.8.4.

For now, my only workaround is to gather all the dependencies into a local path and point pip3 at it

scp conan-1.4.4.tar.gz installserver:/tmp/pip_cache
[...]
scp patch-1.16.zip installserver:/tmp/pip_cache
[...]
scp pyparsing-2.2.0-py2.py3-none-any.whl installserver:/tmp/pip_cache
ssh installserver
installserver$ pip3 install --no-index --find-links="/tmp/pip_cache" conan
1

1 Answers

4
votes

The reason you are unable to install the "patch" Pypi package via Artifactory is that it does not comply with the Python spec.

Based on Python spec (https://www.python.org/dev/peps/pep-0314/ and https://packaging.python.org/tutorials/packaging-projects/), the structure of a Python package should be, for example:

└── patch-1.16.zip
    └── patch-1.16
        ├── PKG-INFO
        ├── __main__.py
        ├── patch.py
        └── setup.py

However, the zip archive (can be found here https://pypi.org/project/patch/1.16/#files) is structured like that:

└── patch-1.16.zip
    ├── PKG-INFO
    ├── __main__.py
    ├── patch.py
    └── setup.py

Artifactory is searching for the metadata file (PKG-INFO in this case) in a certain pattern (inside any folder). Since the PKG-INFO is in the root of the zip (and not in a folder), it cannot find it, therefore, this package's metadata will not be calculated and it will not appear in the "simple" index file (see the error in artifactory.log). As a result, you are unable to install it with pip.

Workaround:

What you can do is manually changing the structure to the correct one.

Create a folder named patch-1.16 and extract the zip to it. Then, zip the whole folder, so you will get the structure like the example above. Finally, deploy this zip to Artifactory. This time, the PKG-INFO file will be found, the metadata will be calculated and pip will be able to install it.