"setup.py upload" is failing with "Upload failed (401): You must be identified to edit package information"

dbr picture dbr · Oct 15, 2009 · Viewed 12.3k times · Source

When running..

python setup.py sdist register upload

..I get the following output:

running register
We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]:  1
Username: example
Password: ...
Registering mypackage to http://pypi.python.org/pypi
Server response (200): OK
I can store your PyPI login so future submissions will be faster.
(the login will be stored in /Users/dbr/.pypirc)
Save your login (y/N)?y
running upload
Submitting dist/mypackage-1.2.1.tar.gz to http://pypi.python.org/pypi
Upload failed (401): You must be identified to edit package information

It's prompting to save the login details, despite ~/.pypirc already containing this. It then fails to upload files for a package I own, and have full write-access to.

Answer

dbr picture dbr · Oct 15, 2009

Just found this page, which solves the issue:

I also noticed that while it was asking me to save my login information, and I hit Y everytime, it still asked me for the username and password. It turned out that it was saving the information incorrectly as follows:

[pypi]
username:dcramer
password:*******

Changing it out to this solved the problems:

[server-login]
username:dcramer
password:********

The above content goes into the .pypirc file in the user's home directory.

Ugh.. I think this may be a good time to give distribute a try..