ARTIFACTORY: How to Create a Custom Distribution Wheel File For PyPi

Raphael Zaafrani
2022-07-19 12:46

At times you will find yourself with a pip install failure stating that a package or a specific version of a package cannot be found. But when browsing Artifactory's repository, you find the package.

Taking the package numexpr for example, you would see a similar error:
User-added image

This is due to distribution tags in the wheel file generated by python not containing the distribution of your current machine.  One way to tell if this is the case is if only a .tar.gz PyPi source code archive can be installed on the build server when there are newer wheel versions.

You can fix that by regenerating the wheel file on the build system. 

  1. Download the python archive from your Artifactory instance locally to your build machine.
  2. Open the archive with the following command:
    • tar -xvf <package-name>.tar.gz
  3. Navigate to the inflated package folder
  4. Install the dependencies:
    • pip install .
  5. Create the new archive and reupload the PyPi package:
    • python3 setup.py bdist_wheel upload -r local

After having followed these steps you should be able to use this package on your build system without any hiccups.