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

Invalid or non-existent authentication information #941

Closed
tylerlong opened this issue Jan 24, 2017 · 50 comments
Closed

Invalid or non-existent authentication information #941

tylerlong opened this issue Jan 24, 2017 · 50 comments

Comments

@tylerlong
Copy link

@tylerlong tylerlong commented Jan 24, 2017

When I run python setup.py sdist upload

I always get:

Submitting dist/xxxxxxx-0.1.4.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information.
error: Upload failed (403): Invalid or non-existent authentication information.

It never asks me to enter my username but only password. So I assume the username is the same as when I run "register".

I am pretty sure that password I entered is correct because I can login https://pypi.python.org/pypi

Could you please help? I am not new to pypi. I published several packages before. But now I am confused. What has changed recently?

@tylerlong
Copy link
Author

@tylerlong tylerlong commented Jan 24, 2017

OK, I have got it done.

I turns out that I have to create ~/.pypirc

Entering password in terminal just doesn't work. It's very likely a bug. Because password is correct and it didn't give me chance to enter username.

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Feb 3, 2017

I was looking through this code recently. I think if there's no pypirc entry present, an empty username is used. The behavior exists upstream in distutils.

I did draft a change which would allow the username to default to getpass.getuser(), which is often a good default and which can be readily overridden with an environment variable.

I'll send a PR for review.

Loading

@dover247
Copy link

@dover247 dover247 commented Feb 11, 2017

Heres What I Did To Fix:

Created ~/.pypirc File With The Following Contents:

[distutils]
index-servers =
    pypi

[pypi]
repository: https://pypi.python.org/pypi
username: <username>
password: <pass>

Loading

@seanbehan
Copy link

@seanbehan seanbehan commented Mar 2, 2017

I ran into the same problem. I'm on a new OS X Sierra. Adding [server-login] entry to ~/.pypirc seemed to fix it http://www.seanbehan.com/how-to-fix-pypi-upload-failed-403-invalid-or-non-existent-authentication-information/

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Mar 2, 2017

@seanbehan: That [server-login] section is for old versions of Python (Python 2.5 and earlier if I recall correctly). Late versions still support this format, but I definitely recommend against it. Did you try the approach with the [distutils] section? Official docs are here.

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Mar 2, 2017

To the best of my knowledge, the behavior is working as expected.

Loading

@jaraco jaraco closed this Mar 2, 2017
@seanbehan
Copy link

@seanbehan seanbehan commented Mar 3, 2017

@jaraco Thanks for the reply. I am using python 2.7 (homebrew python install on new mac book pro sierra) and the info from the docs you supplied does not work for me.

I have tried many variations and only [server-login] seems to work.

Loading

@koalalorenzo
Copy link

@koalalorenzo koalalorenzo commented Mar 15, 2017

Same problem here, as well with homebrew on macOS Sierra

Loading

@tgalal
Copy link

@tgalal tgalal commented Mar 23, 2017

same for me, python2.7 only [server-login] seems to work, everything results in asking for password at upload, and then auth problem. Although same config, unchanged, same upload command, unchanged, same python major version (2.7) used to work a few months a go with config format @dover247 suggests

Loading

@aphearin
Copy link

@aphearin aphearin commented Mar 23, 2017

I just now attempted a new release and can report the exact same experience as @tgalal.

Thanks to @seanbehan for taking the time to post a workaround, which worked perfectly well for me.

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Mar 26, 2017

Well, the server-login workaround is a bad one, and it will probably break at some point. I wonder if this issue has emerged due to the fairly recent changes to support warehouse. Setuptools patches upload to use https://upload.pypi.org/legacy/ as the default repository (instead of https://pypi.python.org/pypi.

For what it's worth, I upload packages to PyPI at least weekly. I use the latest setuptools and Python and my pypirc looks like this:

[distutils]
index-servers =
    pypi

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

There's no password entry because I rely on the keyring support to resolve the password (and store it securely).

Loading

@seantrue
Copy link

@seantrue seantrue commented Apr 29, 2017

@tgalal
The critical change for me was in @jaraco 's latest comment. I changed
repository: https://pypi.python.org/pypi to repository: https://upload.pypi.org/legacy/ and everything worked as promised.

Loading

@boxed
Copy link

@boxed boxed commented May 5, 2017

The very existence of this issue, the number of people commenting, etc, shows this stuff is really quite bad :(

Could someone explain why https://upload.pypi.org/legacy/ is a URL that we should/can use?

Loading

@tao12345666333
Copy link

@tao12345666333 tao12345666333 commented Jun 16, 2017

@jaraco Thanks.

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Jun 17, 2017

The legacy URL is something that the new Warehouse service provides for compatibility with Python (distutils). That URL will continue to work after PyPI.python.org is removed.

Loading

@reteps
Copy link

@reteps reteps commented Jun 28, 2017

It's not working for me. This is my file:

[distutils]
index-servers = 
  pypi

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

gives me this error

Submitting dist/cityinfowrapper-1.0.0.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information.
error: Upload failed (403): Invalid or non-existent authentication information.

when I run python3 setup.py sdist upload.

The full thing is:

running sdist
running egg_info
writing cityinfowrapper.egg-info/PKG-INFO
writing dependency_links to cityinfowrapper.egg-info/dependency_links.txt
writing requirements to cityinfowrapper.egg-info/requires.txt
writing top-level names to cityinfowrapper.egg-info/top_level.txt
file cityinfowrapper/py.py (for module cityinfowrapper.py) not found
reading manifest file 'cityinfowrapper.egg-info/SOURCES.txt'
writing manifest file 'cityinfowrapper.egg-info/SOURCES.txt'
running check
creating cityinfowrapper-1.0.0
creating cityinfowrapper-1.0.0/cityinfowrapper
creating cityinfowrapper-1.0.0/cityinfowrapper.egg-info
copying files to cityinfowrapper-1.0.0...
copying README.txt -> cityinfowrapper-1.0.0
copying setup.py -> cityinfowrapper-1.0.0
copying cityinfowrapper/__init__.py -> cityinfowrapper-1.0.0/cityinfowrapper
copying cityinfowrapper.egg-info/PKG-INFO -> cityinfowrapper-1.0.0/cityinfowrapper.egg-info
copying cityinfowrapper.egg-info/SOURCES.txt -> cityinfowrapper-1.0.0/cityinfowrapper.egg-info
copying cityinfowrapper.egg-info/dependency_links.txt -> cityinfowrapper-1.0.0/cityinfowrapper.egg-info
copying cityinfowrapper.egg-info/requires.txt -> cityinfowrapper-1.0.0/cityinfowrapper.egg-info
copying cityinfowrapper.egg-info/top_level.txt -> cityinfowrapper-1.0.0/cityinfowrapper.egg-info
Writing cityinfowrapper-1.0.0/setup.cfg
Creating tar archive
removing 'cityinfowrapper-1.0.0' (and everything under it)
running upload
Password: 
Submitting dist/cityinfowrapper-1.0.0.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information.
error: Upload failed (403): Invalid or non-existent authentication information.

running pip3 install cityinfowrapper gives me:

Collecting cityinfowrapper
  Could not find a version that satisfied the requirement cityinfowrapper (from versions: )
No matching distribution found for cityinfowrapper

Loading

@lebedov
Copy link

@lebedov lebedov commented Jul 7, 2017

I observed the Upload failed (403): Invalid or non-existent authentication information error using the same .pypirc file as @reteps, but only when I ran setup.py with Python 2.7; using Python 3.4, I was able to build the source tarball, wheel, and upload without any problems.

Loading

@alcalyn
Copy link

@alcalyn alcalyn commented Jul 7, 2017

Getting this same issue with Python 3.6.1.

Having my .pypirc file:

[distutils]
index-servers =
  pypi

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

Loading

@mrooney
Copy link

@mrooney mrooney commented Jul 10, 2017

The [distutils] section helped, though it seems like a setuptools bug that asks for a password that is never going to work without asking for a username. Also, the documentation at https://packaging.python.org/tutorials/distributing-packages/#uploading-your-project-to-pypi is wrong so...it took quite a bit of flailing to figure this out. The pypirc solution is great, but why doesn't setuptools prompt correctly from the command line in the first place?

Loading

@boxed
Copy link

@boxed boxed commented Jul 10, 2017

Loading

@alcalyn
Copy link

@alcalyn alcalyn commented Jul 10, 2017

Well I made it work by trying many times with different settings, I think that doing a chmod 600 on this, putting it in ~/.pypirc and restarting bash was the right things

Loading

@fpelliccioni
Copy link

@fpelliccioni fpelliccioni commented Jul 11, 2017

Same problem here, using:

Ubuntu 17.04
Python 2.7.13

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Jul 26, 2017

why doesn't setuptools prompt correctly from the command line in the first place?

The upload command was originally implemented in distutils. Setuptools has only extended it. Nevertheless, in 20.10, Setuptools adds prompting support.

the documentation is wrong

If you think you can improve the guide, your help would be most appreciated. Please see the section on contributing to the guide.

Loading

@quietcricket
Copy link

@quietcricket quietcricket commented Aug 29, 2017

I had similar problem but it turned out to be my repository parameter was wrong in my .pypirc file. And you do not need to specify repository any more. Once I removed it, my upload succeeded.

Loading

@ghost
Copy link

@ghost ghost commented Sep 10, 2017

The same issue.
.pypirc

[distutils]
index-servers =
  pypi

[pypi]
repository: https://upload.pypi.org/legacy/
username: left-join
password:

Trying to upload:

python setup.py sdist
...
python setup.py upload
Password:
error: No dist file created in earlier command

Ok, let's google & try again:

Trying to upload:
```bash
python setup.py sdist upload
...
Password:
Submitting dist/Flask-Settings-0.0.3.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information.
error: Upload failed (403): Invalid or non-existent authentication information.

The login/password pair is correct, I have just logged in with it.

Loading

@alejandrobll
Copy link

@alejandrobll alejandrobll commented Sep 12, 2017

I fixed the problem by following the instructions written down here: https://packaging.python.org/guides/migrating-to-pypi-org/#uploading.

In my case, I used distutils 2.7.13, and removed the repository line from my ~/.pypirc file:

[distutils]
index-servers =
pypi

[pypi]
username: your username
password: your password

Hope this helps!

Loading

@ssbarnea
Copy link

@ssbarnea ssbarnea commented Oct 7, 2017

Somehow I get the same error while using Travis deploy and I am pretty sure I recorded the credentials correctly. I am afraid that in this case I cannot use the ~/.pypirc trick.

Loading

@Syntaf
Copy link

@Syntaf Syntaf commented Nov 11, 2017

How is this done through windows? It's beyond me pypa thought it would be a good idea to supply an empty username when you try uploading via the command line.

Loading

@Noxalk

This comment was marked as off-topic.

@JesseAldridge
Copy link

@JesseAldridge JesseAldridge commented Nov 26, 2017

I hit this same error. I changed my password on PyPI and was trying to use the new one. I can upload successfully with my old password. Seems like something is broken with password reseting.

Loading

@duhaime
Copy link

@duhaime duhaime commented Dec 19, 2017

If you get a Upload failed (403) response, make sure you have an account and can login on Pypi with the credentials you're using!

Mine weren't active yet, which gave me the 403 response.

Loading

@jeevan449
Copy link

@jeevan449 jeevan449 commented Feb 12, 2018

By providing username and password in upload.py is worked for me.
\Python\Python36-32\Lib\distutils\command\upload.py in the initialize_options() method in
upload class. Enter username and password. Then run command.

python setup.py sdist upload

Loading

@charlesreid1
Copy link

@charlesreid1 charlesreid1 commented Apr 8, 2018

Loading

@cnobile2012
Copy link

@cnobile2012 cnobile2012 commented May 5, 2018

I'm able to upload my package to https://upload.pypi.org/legacy/, but not to https://test.pypi.org/legacy/.
The username and password are the same, but it just doesn't let me upload the file. I get the response:
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://test.pypi.org/legacy/

I've tried entering the username and password manually and using the settings in the .pypirc file.

Any ideas where the issues is?

Loading

@d-rams
Copy link

@d-rams d-rams commented May 21, 2018

I had the same problem @cnobile2012, until I realized I needed a separate registration, login etc. for test as well as the regular pypi server.

Loading

@capooti
Copy link

@capooti capooti commented May 22, 2018

I lost one hour on this and then I figured out that both my test and upload accounts (which used to work before) had an unverified email. After verifying the email everything works expected as it used to be.

Loading

@di
Copy link
Member

@di di commented May 22, 2018

@capooti You should have been getting an error message indicating that your email address needed verification, was this not the case?

Loading

@capooti
Copy link

@capooti capooti commented May 23, 2018

@di I didn't get that message

Loading

@tutuca
Copy link

@tutuca tutuca commented May 28, 2018

So there is no way to upload the package from command line only. There is no way to workaround the need of a .pypirc?
Most CI tools don't allow custom files in the home folder, so you have to rely on hacky steps like echo the file on some job.

Loading

@Mr-Optimistic
Copy link

@Mr-Optimistic Mr-Optimistic commented Jul 9, 2018

I made a .pypirc in my home directory
The contents were :
[server-login]
username:abc
password:xyz

Dint add repo

Worked for me

Loading

@cnobile2012
Copy link

@cnobile2012 cnobile2012 commented Jul 15, 2018

After reading a few posts to this thread @Mr-Optimistic provided the answer to my issue. Up until now, I didn't know there was the directive [server-login]. After adding that to my .pypirc file everything seems to know work.

Loading

@DusanMadar
Copy link

@DusanMadar DusanMadar commented Aug 5, 2018

BTW username != email in .pypirc.

Loading

@dansgithubuser
Copy link

@dansgithubuser dansgithubuser commented Aug 7, 2018

I can't reproduce how I got confused, but I was under the impression python setup.py sdist upload and python setup.py bdist_wheel upload require configuration of different repositories. However, the following ~/.pypirc works for both:

[distutils]
index-servers =
    pypi

[pypi]
username: danspypiuser
password: <password>

So how is this supposed to work in CI? Without access to home directory? How can I grab my creds out of env vars? How do I manage two pypi users?

edit: seems twine is the replacement for these tools
https://packaging.python.org/guides/distributing-packages-using-setuptools/#uploading-your-project-to-pypi

Loading

@dschrempf
Copy link

@dschrempf dschrempf commented Dec 4, 2018

It also took me an hour to realize that one needs a separate account for https://test.pypi.org/. This should definitely be stated in the tutorials on https://packaging.python.org/tutorials/packaging-projects/ ...

Loading

@di
Copy link
Member

@di di commented Dec 4, 2018

https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives currently says:

Finally, it’s time to upload your package to the Python Package Index!

The first thing you’ll need to do is register an account on Test PyPI. Test PyPI is a separate instance of the package index intended for testing and experimentation. It’s great for things like this tutorial where we don’t necessarily want to upload to the real index. To register an account, go to https://test.pypi.org/account/register/ and complete the steps on that page.

Is there somewhere else that would be better for that information? Seems like it's in the right spot to me.

Loading

@dschrempf
Copy link

@dschrempf dschrempf commented Dec 11, 2018

I don't know how I missed that, but apparently it happened 😄.

Loading

@fabioespinosa
Copy link

@fabioespinosa fabioespinosa commented May 3, 2019

You can create a test.pypi.org account here: https://test.pypi.org/account/register/

Loading

@JiaxiangBU
Copy link

@JiaxiangBU JiaxiangBU commented Jul 25, 2019

It also took me an hour to realize that one needs a separate account for https://test.pypi.org/. This should definitely be stated in the tutorials on https://packaging.python.org/tutorials/packaging-projects/ ...

I agree with you!!! I also spend half an hour on it and find I don't do the registration for the test one.

Loading

@gauravsharmadev
Copy link

@gauravsharmadev gauravsharmadev commented Oct 4, 2019

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

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

Loading

@reubano
Copy link

@reubano reubano commented Nov 7, 2019

same error

.pypirc

[distutils]
  index-servers =
    pypi

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet