Search code examples
pythonproxypip

Proxy awareness with pip


I have tried to set up a python development environment at my work place to create some basic applications. I can't seem to get pip to work, for example I type in pip install numpy and get the following error message:

  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x035884B0>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/numpy/

The research I have done seems to indicate that proxy awareness is my issue, is this correct, if so I am not really sure on what this means exactly or how to resolve it.


Solution

  • If you know your proxy information, you can pass that to your command line:

    pip install --proxy=user:pass@server:port numpy
    

    A full string could be something as simple as:

    pip install --proxy=http://proxy.example.com numpy
    

    Where proxy.example.com is your (corporate) proxy server. You only need to pass user:pass and port if the proxy also requires that information.