Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 374
dbr Avatar asked Oct 14 '09 22:10

dbr


4 Answers

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..

like image 104
dbr Avatar answered Nov 09 '22 22:11

dbr


None of the changes to ~/.pypirc listed here worked for me.

This worked for me, with no changes to ~/.pypirc. I added "-r https://www.python.org/pypi" to the command line:

python setup.py register sdist upload -r https://www.python.org/pypi

My ~/.pypirc looks like this

[distutils]
index-servers: pypi

[pypi]
username: dlink
password: ******** (the real one)
like image 43
dlink Avatar answered Nov 10 '22 00:11

dlink


I have the same problem, This is my solution.

The python version is 2.7.7, my windows version is Windows-7-6.1.7601-SP1.

here is my .pypirc file

[distutils]
index-servers=pypi

[pypi]
repository = https://pypi.python.org/pypi

[server-login]
username = user
password = password

Notice:

In windows, A file is not allowed named as “.pypirc”,plz,refer to:

Rename files to empty filename in Windows

Then put you ".pypirc" file in the same folder with "setup.py"

At last:

run :

python setup.py sdist upload

or:

python setup.py sdist register upload

I hope this will be help,thank you!

like image 4
kongyue Avatar answered Nov 10 '22 00:11

kongyue


I have this problem and solved it by putting the file .pypirc under my home directory (~/), as the last past of the first comment suggests.

I didn't have the need to modify the name of the section "pypi" of the file pypirc for "server-login", as suggested also in the first comment.

like image 1
Jasg Avatar answered Nov 09 '22 23:11

Jasg