Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 Client Error: Invalid or non-existent authentication information. #424

Closed
kstenerud opened this issue Nov 7, 2018 · 18 comments
Closed
Labels
support Users asking for help using twine

Comments

@kstenerud
Copy link

Your Environment

  1. Your operating system: Ubuntu 18.10

  2. Version of python you are running:

Python 2.7.15+
  1. How did you install twine? Did you use your operating system's package manager or pip or something else?

I followed instructions at https://pypi.org/project/twine/

pip install twine

Then when I tried to run it, I was instructed to run:

sudo apt install twine
  1. Version of twine you have installed (include complete output of):
twine version 1.11.0 (pkginfo: 1.4.2, requests: 2.18.4, setuptools: 40.2.0,
requests-toolbelt: 0.8.0, tqdm: 4.23.4)
  1. Which package repository are you targeting?

I don't know what this means.

$ cat darip.egg-info/PKG-INFO 
Metadata-Version: 1.0
Name: darip
Version: 1.0.0
Summary: Bulk downloads images from Deviant Art
Home-page: https://github.com/kstenerud/darip/
Author: Karl Stenerud
Author-email: kstenerud@gmail.com
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
$ cat ~/.pypirc 
cat: /home/karl/.pypirc: No such file or directory

The Issue

I get an HTTP error following the instructions at https://pypi.org/project/twine/

Steps to Reproduce

If the issue is predictable and consistently reproducible, please list the steps here.

$ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Uploading distributions to https://test.pypi.org/legacy/
Enter your username: kstenerud
Enter your password: 
Uploading darip-1.0.0-py2-none-any.whl
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 8.02k/8.02k [00:00<00:00, 9.58kB/s]
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://test.pypi.org/legacy/
@sigmavirus24
Copy link
Member

https://test.pypi.org/user/kstenerud/ does not exist. You have to create your login there first.

The error message could be improved by PyPI but is not in the domain of Twine in my opinion.

@teto

This comment has been minimized.

@Kamleshgupta1
Copy link

Instead of
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

write
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

I was also having same problem but by typing commands this way, my problem got solved.

@Foxgeek36
Copy link

Instead of
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

write
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

I was also having same problem but by typing commands this way, my problem got solved.

the perfect solution

@bhrutledge
Copy link
Contributor

@Foxgeek36 and @Kamleshgupta1:

The correct solution when --repository-url https://test.pypi.org/legacy/ fails due to Invalid or non-existent authentication information is to create an account on https://test.pypi.org/, which is "a separate instance of the Python Package Index that allows you to try distribution tools and processes without affecting the real index."

Using --repository-url https://upload.pypi.org/legacy/ will upload your package to https://pypi.org/, which publishes it "for real".

@adamcanray
Copy link

adamcanray commented Nov 5, 2019

hi,
when we enter the password, the password is definitely not wrong and I think it's a bug. so I try to use -u for the username and -p for the password directly without using the fields provided by the console (default).
I try to run this in the command: twine upload -u YOUR-USERNAME -p YOUR-PASSWORD - repository-url https://test.pypi.org/legacy/ dist / *
Capture_distribute_packages_upload_2
it really works for me.
thanks:)

@reubano
Copy link

reubano commented Nov 7, 2019

Same error

uploading to https://upload.pypi.org/legacy/
twine==2.0.0
Python 3.7.5
username and password set in .pypirc

@bhrutledge
Copy link
Contributor

@reubano Can you show the exact twine command that you ran, with the output? Also, what's your username on PyPI?

@reubano
Copy link

reubano commented Nov 8, 2019

twine upload dist/*
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
twine upload --repository-url https://upload.pypi.org/legacy/ dist/* --password password 

@bhrutledge
Copy link
Contributor

@reubano I'm afraid that's not enough information. Notably missing is the output of the commands, and the username that's in .pypirc.

That said, I'm fairly confident that this is not an issue with Twine, but rather a configuration issue. I think you might get more help by posting a detailed issue at https://github.com/pypa/packaging-problems.

@vsay01
Copy link

vsay01 commented Nov 23, 2019

I tried @adamcanray solution, and it's working. The only thing i need to do is to put '' around user name and password; otherwise, it fails.

twine upload -u 'YOUR-USERNAME' -p 'YOUR-PASSWORD' - repository-url https://test.pypi.org/legacy/ dist / *

@reubano
Copy link

reubano commented Dec 3, 2019

Thanks @vsay01 and @adamcanray this worked!

twine upload -u 'USERNAME' -p 'PASSWORD' --repository-url https://upload.pypi.org/legacy/ dist/*

Here are my other config options

.pypirc

[distutils]
  index-servers =
    pypi

[pypi]
  repository: https://upload.pypi.org/legacy/
  username: reubano
  password:

.localrc

export TWINE_USERNAME=reubano

@reubano
Copy link

reubano commented Apr 9, 2020

After more trouble shooting, the bare minimum working command is twine upload --repository-url https://upload.pypi.org/legacy/ dist/* I think the .pypirc username config var is now being read.

@bhrutledge
Copy link
Contributor

@reubano I'm glad this is working for you. FWIW, since twine has defaults for pypi, I think this should be sufficient:

.pypirc

[pypi]
username: reubano
password: 

Command:

twine upload dist/*

That said, I would recommend not storing your password in .pypirc or an environment variable, but rather using keyring.

Even better would be to use PyPI API tokens instead of your username/password.

@pantuza
Copy link

pantuza commented Feb 17, 2021

I had this same issue uploading dist to test.pypi.org.
Invalid or non-existent authentication information

Although, in my case the problem was simply because my email address was not verified.
I referred to PyPi web site, gone to Account Settings page and Verified my email.

After that my twine upload --repository-url https://test.pypi.org/legacy/ dist/* worked well.

@diogobaltazar
Copy link

Having verified accounts in PyPI and TestPyPI, contents for ~/.pypi:

[distutils]
index-servers=
    pypi
    testpypi

[pypi]
repository: https://upload.pypi.org/legacy/
username: ***
password: ***

[testpypi]
repository: https://test.pypi.org/legacy/
username: ***
password: ***

After building the package, publishing for TestPyPI:

twine upload --repository testpypi dist/*

Publishing for PyPI:

twine upload --repository pypi dist/*

@khizerkamran

This comment has been minimized.

@wcuny
Copy link

wcuny commented Aug 13, 2022

Make sure you guys make an account for testpypi AND pypi. It is two different things. I went through every single comment on this thread before I realized that its two different things. Once you make the new account for pypi and verify the email, the upload feature will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Users asking for help using twine
Projects
None yet
Development

No branches or pull requests