How to troubleshoot PyPi issues

Patrick Russell
2018-11-13 23:49


Comparing correct PyPi REST API calls can show where the problem lies.

Affected Versions

4.0.2 – Latest


When troubleshooting PyPi errors it is best to compare what is supposed to happen against what is currently happening. You can eliminate a great deal of noise by simulating each step the client takes, and examining what HTTP return code is sent by Artifactory.

In general, these return codes indicate where to look 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. The Artifactory request logs display the exact API commands the Docker client uses.

You can use the examples below, or substitute the one that is failing in the Artifactory request.log file. Doing so should yield further information on the problem, and possible next steps.

Basic 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-group

pip install
When a user installs a package using the Pip client, they make use of the PyPi REST API to download the package. The pip client does a few actions when attempting to install a package through Artifactory. The process begins when a user enters the following command:
pip install nginxctl

The client first pulls the metadata from the “/simple” API endpoint:


Using this metadata, it downloads the .tar.gz file:


The client then installs the package from the downloaded .tar.gz.

Deploying Packages:
When you have configured the package’s .pypirc to point to Artifactory, you can then run the following command to initiate the deployment:

python sdist upload -r local
python bdist_wheel upload -r local

This performs a POST action that submits the package to Artifactory:


Depending on if you specified a Python Wheel or a simple package upload, you will see the deployed file in your PyPi local repository:

Example PyPi package

In Artifactory PyPi package metadata is available under “/api/pypi/<PyPi_Repo>/simple/”. You can inspect this URL in your web browser to see if there is a problem getting the PyPi package metadata:
Deployed PyPi package