简体   繁体   中英

Having problems uploading python to Nexus 3.8 - 401 error

I've just upgraded Nexus to 3.8.0-02 OSS to get Python Pypi support.

I've created a pypi-hosted and a pypi-proxy and an additional pypi-group to merge them. I've given myself all roles related to those repositories. All works fine in the UI and pip can query that proxy repository just fine (no credentials).

Problem is I cannot publish from setuptools in python. My ~/.pypirc mode 0600 and contains: [distutils] index-servers = nexus

[nexus] repository: https://ld3-nexus-3-kev.pibenchmark.com:8443/nexus/repository/pypi-hosted/ username: kevin_thorpe password: XXXXXXX

This username and password works just fine for Maven so I know it's not that. If I do python setup.py register -r nexus then I get a 401 response. Same results using twine as in the docs. Oddly there's nothing logged on what is obviously a failed login. Traffic is going to the server but I can't see what's in the packets. I've tried both my LDAP user and a local usr with the same results.

How do I go about debugging the problems with the connection? It appears to only be python that's the problem

I can reproduce the error with:

python3 setup.py register -r myserver

In request.log:

10.255.0.3 - - [16/Feb/2018:19:12:51 +0000] "POST /nexus/repository/pypi/ HTTP/1.1" 401 0 3 "Python-urllib/3.6"

Mind the second - should be the username but NONE gets there.

Output example using curl: curl -u admin -X POST https://my_awesome_nexus_server/nexus/repository/pypi/ :

10.255.0.3 - admin [16/Feb/2018:19:14:45 +0000] "POST /nexus/repository/pypi/ HTTP/1.1" 500 1948 15 "curl/7.55.1"

Tested on Docker Container, latest (3.8), and 3.7. It seems to me that problem is at client side instead.

UPDATE: Managed to make it work with twine (in a virtualenv):

python3 setup.py build
twine upload -r myserver dist/mypackage-0.1.0.tar.gz

And it is available at Nexus3 (3.7).

My suggestion for troubleshooting is to look at the nexus.log and request.log for more detailed log statements. These can be found in your data directory in the "log" subdirectory.

Another option is to file a ticket in https://issues.sonatype.org/projects/NEXUS/ and see if the Sonatype staff have any more ideas. It would be helpful if you include a support.zip (documented here: https://help.sonatype.com/display/NXRM3/Support+Features#SupportFeatures-CreatingaSupportZIP ) which will include the logs when you do this.

I apologize for the somewhat generic advice but I see nothing wrong with your configuration from your post details so far.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM