Not able to upload package in

After a lot of trial and error, I found the simple solution. Also, @hoefling answer helps me to solve them.

Register as a user in and use register account command which mentioned in the question.

Now, Three magic steps which will resolve the issue.

pip install twine

python sdist

# This will ask for you username and password
twine upload dist/*


If you want to upgrade your package, just follow the below simple steps:

  1. Delete the build, dist, and <package name>.egg-info folders in your root directory.
  2. Change the version number in your file.
  3. Create distribution again. e.g: python sdist bdist_wheel
  4. Upload distribution again. e.g: twine upload dist/*

First of all, note that register is deprecated and not necessary anymore. When trying to register a package on PyPI, you should get a message:

Server response (410): This API is no longer supported, instead simply upload the file.

Just skip the register step and proceed with the uploading.


Create a file $HOME/.pypirc with the contents:

index-servers =

username: <username>
password: <password>

and repeat the upload:

$ python sdist upload

Thing is, the distutils' upload subcommand doesn't provide an option to enter the credentials from command line, instead completely relying on the .pypirc file.


If storing credentials in plain text format is not your thing, twine provides a possibility of entering credentials from command line. This is also the officially recommended tool for uploading packages.

  1. Install twine:

    $ pip install twine
  2. Build the package:

    $ python clean sdist
  3. Upload:

    $ twine upload dist/*

    The tool will ask you for the username and password.

twine also lets you provide the credentials in environment variables:

$ TWINE_USERNAME=me TWINE_PASSWORD=passwd twine upload dist/*

or via keyring.

Create a file in home dir by touch ~/.pypirc similar look like: added pytest optionally

index-servers =



Things to care about the following error

403: Invalid or non-existent authentication information

  • If there is a % in your password just type it without escaping; e.g. Hello%123

  • If there is a space character in your password just type it without quotes; e.g. Hello 123

Register your package against PyPI's server

python register -r pypi

Upload your package

python sdist upload -r pypi

From official doc

First, you need a PyPI user account