Create and use a PyPi proxy repository on nexus
Asked Answered
R

3

16

Running Nexus 3 OSS 3.6.0-02 I have created a pypi proxy repository on nexus using this guide:

https://help.sonatype.com/repomanager3/pypi-repositories

With the following info:

Format: pypi
Type: proxy
URL: https://mynexus:9666/nexus/pypi-proxy/
Remote Storage:https://pypi.org/
Authentication: Username/Password

Now I would like to install a package and use the above proxy. Based on:

How to get pip to work behind a proxy server

and this example:

pip install --proxy http://user:password@proxyserver:port <package>   

I have tried:

pip install --proxy https://myuser:mypassword@mynexus:9666/nexus/pypi-proxy/ testinfra --no-cache-dir

But I get:

Collecting testinfra
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Invalid response from tunnel request',))': /simple/testinfra/

Is there and error in my command line? Or something I need to configure on the server/repository?

Riggs answered 6/2, 2019 at 13:12 Comment(1)
curious how you created a pypi proxy. i am using nexus:oss on docker hub and the only options i get are maven1/2, nuget, npm, and gemsAvalos
I
15

Just add /simple at the end of index URL

pip install --index-url https://myuser:mypassword@mynexus:9666/nexus/pypi-proxy/simple/

Infecund answered 8/11, 2019 at 17:37 Comment(1)
This works. Can anyone explain why ?Gleeman
U
6
export PYPI_USER=<Username>
export PYPI_PASSWD=<Password>
export PYPI_HOST=mynexus:9666/nexus/pypi-proxy/simple/

pip config --global set global.index-url https://$PYPI_USER:$PYPI_PASSWD@$PYPI_HOST
pip config --global set global.trusted-host $PYPI_HOST

pip install testinfra
Unlay answered 16/12, 2021 at 15:59 Comment(1)
Don't ever use basic auth with http as it is insecure. Use https insteadMusclebound
A
0

try

pip install --index-url http://user:password@proxyserver:port <package>

per https://pip.pypa.io/en/stable/user_guide/

Avalos answered 1/11, 2019 at 19:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.