5
votes

I am looking to deploy a Module to PyPI and this error is thrown in the console:

HTTPError: 403 Client Error: The credential associated with user 'aloisdg' isn't allowed to upload to project 'example-pkg-your-username'. See https://test.pypi.org/help/#project-name for more information. for url: https://test.pypi.org/legacy/

It is possible to reproduce the error by following step by step the tutorial in the official documentation: Packaging Python Projects.

My credential works fine when I try to connect to the PyPI website directly.

Why cant I upload my own package?

2

2 Answers

5
votes

This error means that you can't upload this package because you, as a user, are not allowed to. Why? Because it is not your package. Someone already created a package with this name. Your package is seen as an update to this already existing package. You won't have this error if the original creator would include you as maintainer of this package.

How to fix this error? Replace example-pkg-your-username with example-pkg-aloisdg (or any name absent from PyPI).

This answer was inspired by issue #4607.

2
votes

You missed this step in the tutorial:

Open setup.py and enter the following content. Update the package name to include your username (for example, example-pkg-theacodes), this ensures that you have a unique package name and that your package doesn’t conflict with packages uploaded by other people following this tutorial.

Change the package name to be something unique and your upload will succeed.