4
votes

I am new to Nexus3, I am following the instruction here to upload a PyPI package (python v2.7): https://books.sonatype.com/nexus-book/3.0/reference/pypi.html
However, I got the following message prevent me from uploading the the package.

HTTPError: 401 Client Error: Unauthorized for url

I did the following steps and not sure if I missed anything:
1. Setup blob and repo name in Nexus3
2. Copy the url to .pypirc
3. python setup.py sdist; twine upload -r nexus3 dist/[secure]-0.1.0.tar.gz

Please suggest, Thanks!

1
which nexus version are you using exactly?Jakob
Are you using admin/admin123? If so is admin enabled? If not, I'd recheck your username/password in your pypirc. 401 indicates it's wrong. I'd ask to see it but if you're not using admin/admin123, it's probably sensitive and I wouldn't be able to tell anyway. Here's mine if it helps: cat .pypirc [distutils] index-servers = nexus [nexus] repository: localhost:8081/repository/pypi-hosted username: admin password: admin123joedragons
@Chengzhi have you tried without .pypirc config ? you can tell twine to which server, worked for me. try - twine upload --repository-url http://<nexus>repository/<Repo-name>/ dist/*Yoni

1 Answers

2
votes

I had to add --config-file .pypirc to twine upload.

So

twine upload --config-file .pypirc -r nexus3 dist/[secure]-0.1.0.tar.gz