How to troubleshoot PyPi issues
Relevant versions: This information pertains to Artifactory versions 4.0.2 and above
When troubleshooting PyPI errors, it's best to compare what is supposed to happen against what your system is currently experiencing. You can eliminate a great deal of noise by simulating each step your client is taking and examining what HTTP error code is sent to you by Artifactory.
In general, these are the error codes you might encounter and where you should explore for answers/solutions next:
- 403 and 401: Authentication issue, examine authorization settings
- 404: Resource not found, check repository for resource
- 400: Incorrect request, use cURL to get reason phrase
- 50X: Server problem, examine artifactory.log
Using curl
The libcurl terminal application can make basic REST API commands, such as GET or PUT options. Artifactory's request logs display the exact API commands your PyPi client uses, you can determine what exact commands to run based on this log file.
You can use the examples below, or substitute the one that is failing for you specifically. Doing so should yield further information on the problem, and possible next steps.
Basic cURL usage (with #comments):
curl -uadmin #Artifactory-username -vvv #verbosy -k #ignore-insecure-SSL -XGET #GET-request http://localhost:8081/artifactory/api/system/ping
cURL uses GET requests by default. Other commands, like PUT, require the --data field, along with the (Usually JSON) data payload. An example PUT command::
curl -uadmin:password -XPUT -H"Content-type: Application/json" --data '{"name":"test-group"}' http://localhost:8081/artifactory/api/security/groups/test-grouppip install
Thereafter, the client will pull the metadata from the /simple API endpoint:
20180524093654|538|REQUEST|127.0.0.1|anonymous|GET|/api/pypi/pypi/simple/nginxctl/|HTTP/1.1|200|0
Using this metadata, the client will download the .tar.gz file:
20180524093656|1412|REQUEST|127.0.0.1|anonymous|GET|/api/pypi/pypi/packages/72/45/936e0805da71fcaf0e5a1f9256f757f5fa95057e391687ba067ef2d52926/nginxctl-1.1.2.tar.gz|HTTP/1.1|200|17024
Then the client will install the package from the downloaded .tar.gz.
Deploying Packages
When you've configured a given package’s .pypirc to point to Artifactory, you can then run the following command to initiate its deployment:
python setup.py sdist upload -r local ---or--- python setup.py bdist_wheel upload -r local
This performs a POST action, which submits the package to Artifactory:
20180524094126|10499|REQUEST|127.0.0.1|admin|POST|/api/pypi/pypi|HTTP/1.1|200|3357
Depending on whether you specified a Python Wheel or a simple package upload, you will see the deployed file in your PyPI local repository:
/simple
In Artifactory, PyPI package metadata is available in your /api/pypi/<PyPi_Repo>/simple/ folder. You can go to this URL in your web browser to see if there's a problem getting the PyPI package metadata:
The hyperlinks that match PyPi package names can be followed, you should see the underlying versions of the package: