43

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.

prayagupa
  • 30,204
  • 14
  • 155
  • 192
Tom
  • 925
  • 3
  • 10
  • 24

11 Answers11

66

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.

Andy
  • 49,085
  • 60
  • 166
  • 233
  • 3
    Or, `pip install --proxy=$http_proxy numpy` is `http_proxy` is setup as a environment var(`export http_proxy=http://proxy.example.com`) – prayagupa Mar 26 '17 at 08:44
  • I get the same error when i try to execute 'pip install' from command prompt. Can someone explain me in detail why i am encountering this error. I understand from the above post that it is an issue associated with Proxy but i am not sure what it is since i am very beginner into programming world. – santhosha Oct 31 '17 at 10:39
  • 1
    nice +1. Is there any way to put this in a config file so I don't have to type it each time? Edit: Never mind, found it: https://stackoverflow.com/a/43473312/1295595 – craq Jun 14 '18 at 21:34
  • I used: pip install --proxy= h t t p://proxy-europe.network.fx.com pandas –  Feb 07 '20 at 15:37
  • One nasty gotcha - make sure the proxy's URL value starts with `http:` rather than `https:`. Otherwise you get nasty warnings like `WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1059: The handshake operation timed out'))'` and your package install will eventually fail. – snark Jan 04 '21 at 15:25
16

pip doesn't work if you are using a proxy server for installing packages. To fix it: Go to control panel -> Internet options -> Connections ->LAN Settings ->Unmark 'use proxy server' options. Try using pip after this, it should work. You can start using proxy server after installing the package.

The_Vats
  • 199
  • 2
  • 9
  • 3
    not sure why someone downvoted this. Thanks A lot The_Vats , this solved my issue in a jiffy! – FlyingZebra1 Jan 01 '18 at 09:14
  • 3
    Well.. I'm at home, I don't have "Use a proxy server..." selected and still can't used pip. – A. Vieira Apr 24 '18 at 19:05
  • 4
    @FlyingZebra1 might be downvoted, because the user would not have the privileges to unmark use proxy server and without proxy server, (s)he would not be able to connect to the Internet at all. Typical, where an employee tries to access Internet behind the organization firewall. – Seshadri R Jan 03 '20 at 03:05
6

This too works

pip --proxy http://user:pass@server:port install libraryName
IndrajitDatta
  • 205
  • 4
  • 13
  • same for me pip had a problem with `--proxy=user:pass@server:port` and the solution was `--proxy http://user:pass@server:port` – An Other Mar 02 '18 at 10:00
5

In order to fix it temporarily, I disconnected from my Secure VPN and then I was able to proceed with download. So, yes, its definitely an issue with proxy.

Shamik Guha Ray
  • 177
  • 2
  • 4
3

The thing that worked for me was to disable the VPN that I was using and after that I tried running the command and it worked for me

    pip install pandas
Saviour24
  • 46
  • 5
1

Just try the below

pip install --proxy=user:pass@server:port <package Name>

for example

pip install --proxy=http://10.10.10.150/accelerated_pac_base.pac quandl 
1

Go to environment variables, and add 2 new variables: http_proxy and https_proxy to your proxy address. It's worked for me.

tomy_lee
  • 19
  • 1
0

I was getting this error message in a virtualbox, and tried every variation of the suggestions here to fix what appeared to be a proxy error. In the end it turned out that the time was set wrong within the virtual machine.

craq
  • 1,441
  • 2
  • 20
  • 39
0

I wanted to install pygame. I use my personal internet connection. But I received an error.

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000023C1F52C400>, 'Connection to 10.50.225.222 timed out. (connect timeout=15)')': /simple/pygame/

In order to avoid this, go to environment variables. Delete http_proxy and https_proxy from user variables located in environment variables. Then I could download the pip whatever thing(It means pygame).

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0
  1. Press Win+R open Run, type in regedit and click OK.

  2. Move to HKEY_CURRENT_USER/Software/Microsoft/Windows/Current Version/Internet Settings.

  3. Find a file name ProxyServer and delete it.

  4. Open PowerShell

  5. Fire a command pip install flask

David Buck
  • 3,752
  • 35
  • 31
  • 35
-1

I encountered the same issue. It turns out that the system time was wrong. Once I corrected the time, pip installed the module without a hitch.

So, check to make sure that your system time is set correctly. It appears that pip does not work correctly when the clock is off.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
llywrch
  • 99
  • 3