pythonuploadhttp-status-code-403pypitwine

403 Client Error: Invalid or non-existent authentication information while uploading to Pypi with twine


403 Client Error: Invalid or non-existent authentication information occurs when uploading new module to pypi with Twine

Win10 Pro 1803 Biuld 17134.1069 64 bit // Python 3.7.5 32 bit // pip 19.3.1

I successfully created tar. and whl. in the dist folder, registered on https://pypi.org/ with e-mail confirmation and started to upload.

I checked both files with command line ('PASSED')

and did the following:

Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: gakonorde
Enter your password:
Uploading gersyll-Alpha.release-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████| 6.43k/6.43k [00:01<00:00, 5.12kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

The command line does not allow me to enter password after username. I only can press ENTER.

I tried also

Password for 'your-username' in 'https://upload.pypi.org/legacy/':

... and again, I can press nothing except of ENTER.

Then I created .pypirc file with credentials for https://pypi.org/ and its test version and run python -m twine upload dist/* again

I was not asked for a password, but got the same error:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading gersyll-Alpha.release-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████| 6.43k/6.43k [00:01<00:00, 5.46kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

When I combine .pypirc with API token, the problem remains the same.

I can enter my account on https://pypi.org/, so it obviously exists (and e-mail is verified).

I also added the second e-mail, verified and set it as primary (nothing changed).

Here is my setup.py:

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="gersyll",
    version="Alpha release",
    author="gakonorde",
    author_email="gabrielko@yandex.ru",
    description="This module counts the number of words of different syllable length for all texts in a directory",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/gakonorde/gersyll",
    packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3.7",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.7',
)

What am I doing wrong?

Any help would be greatly appreciated.

Edit: The .pypirc file is in the same folder as .setup, README, License, dict/ etc.

It's content is as follows:

[distutils]
index-servers =
  pypi
  pypitest

[pypitest]
repository: testpypi.python.org/pypi
username: gakonorde 
password: [my_password]

[pypi]
repository: upload.pypi.org/legacy
username: gakonorde
password: [my_password]

Solution

  • With regards to the password prompt, you won't see any input after the Enter your password: prompt, because it's hiding your password.

    For your .pypirc file, this should be in your home directory (~/.pypirc), not in the same directory as your setup.py file.