Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 406
Kev Thorpe Avatar asked Sep 08 '26 08:09

Kev Thorpe


1 Answers

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

like image 157
Roberto Salgado Avatar answered Sep 09 '26 21:09

Roberto Salgado



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!