Need Proxy?

BotProxy: Rotating Proxies Made for professionals. Really fast connection. Built-in IP rotation. Fresh IPs every day.

Find out more


Installing a Python pip package on Windows 10, through a proxy

Question

I'm trying to install a Python pip package on Windows 10. Unfortunately, the proxy at my work is giving me trouble.

Things I've tried:

  1. python -m pip install --proxy "http://sam.s1:[email protected]:8080"
  2. python -m pip install --proxy http://sam.s1:[email protected]:8080
    1. & 2. with the protocol changed to https
    1. & 2. omitting the protocol, eg: python -m pip install --proxy sam.s1:[email protected]:8080
  3. set HTTP_PROXY=sam.s1:[email protected]:8080 set HTTPS_PROXY=%HTTP_PROXY% set FTP_PROXY=%HTTP_PROXY%
  4. Editing the proxy address for the HTTP_PROXY env variable in the same way described in steps 1 to 4.
  5. Creating a pip.ini file at %APP_DATA%/pip/ with the following contents:

[global] proxy = "http://sam.s1:[email protected]:8080" trusted-host = pypi.python.org

  1. Editing the proxy address in the pip.ini file in the same way described in steps 1 to 4.

They all give me similar errors such as:

Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002A6F091B080>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))': /simple/django/

and

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

and

Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/django/

Although sorting out once and for all how to download packages though the proxy would be nice, I'll settle for instructions on any methods that circumvent the proxy entirely, like downloading the package and compiling from source (I usually use Ubuntu, so I have no idea how to do this type of thing on Windows).

Other information:

  • The proxy is configured via a pac script
  • The package I'm currently trying to install is Django, but there will probably be others in the future.
  • I installed pip when I installed Python 3.6.3 (via the checkbox that says something like, do you also want to install pip as well as Python).
  • I know that pip is grabbing the settings from the .ini file, since I can change the output of $ pip list by setting a value for [list].

Answer

I have no idea about the proxy thing, but you can download Python packages from the Python Package Index (PyPI) and install them with pip. There's no need to compile from source in most cases, and definitely not with Django.

You can download Django here and then install it with pip install <path to downloaded package>.

cc by-sa 3.0