How to overwrite pypi package when doing upload from command line?

A late answer, but: it seems everybody agrees you can’t overwrite existing pypi uploads, or re-upload a fixed version after you delete a broken version. However, it seems actually possible and officially supported: “build numbers” are a feature that nobody has ever used or remembers they exist, but that seems to work, at least for me.

The trick is to rename the files in the following pattern:


The “-1” or “-2” are build numbers. If pip finds all these files for the same release, it will pick the one with the highest build number. It also seems to work if it finds only a single file with a non-zero build number, so you can use that after you deleted the original.

(This is very quickly mentioned in the documentation at but I wouldn’t have guessed its use without Daniel Holth pointing it out to me. Thanks Daniel!)

I have no idea why the internet contains so many people convinced it can’t be done. I myself only learned about it yesterday and thought I should try to pass on that information.

Insert here the usual warning about not to abuse that feature. A typical example for when I think you should use this is after one of the wheels was badly built and you need to replace it with a correctly-built wheel from the same sources

Leave a Comment