0

I have downloaded pip frpm https://sites.google.com/site/pydatalog/python/pip-for-windows

Now when I type any package name or upgrade in the command section I get the following error

Downloading https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Traceback (most recent call last):

 File "C:\Python33\lib\urllib\request.py", line 1248, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "C:\Python33\lib\http\client.py", line 1065, in request
    self._send_request(method, url, body, headers)
  File "C:\Python33\lib\http\client.py", line 1103, in _send_request
    self.endheaders(body)
  File "C:\Python33\lib\http\client.py", line 1061, in endheaders
    self._send_output(message_body)
  File "C:\Python33\lib\http\client.py", line 906, in _send_output
    self.send(msg)
  File "C:\Python33\lib\http\client.py", line 844, in send
    self.connect()
  File "C:\Python33\lib\http\client.py", line 1198, in connect
    self.timeout, self.source_address)
  File "C:\Python33\lib\socket.py", line 435, in create_connection
    raise err
  File "C:\Python33\lib\socket.py", line 426, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected
 party did not properly respond after a period of time, or established connectio
n failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin~1\AppData\Local\Temp\rmv_setup.py", line 60, in <module>

    download(url, "ez_setup.py")
  File "C:\Users\Admin~1\AppData\Local\Temp\rmv_setup.py", line 30, in download

    src = urlopen(url)
  File "C:\Python33\lib\urllib\request.py", line 156, in urlopen
    return opener.open(url, data, timeout)
urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt fail
ed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond>

I am behind a proxy. but I can access bitbucket.org through browser. How can I fix this issue?

codec
  • 5,353
  • 15
  • 52
  • 96
  • As soon I run the downloaded exe a command prompt opens and I get the same error as above. I think pip itslef is not getting installed. – codec May 18 '16 at 06:59

3 Answers3

2

Considering that you successfully installed pip and now you are trying to install another module using pip.

pip has "proxy" option.Please try to use it and check whether it is helpful.

C:\Users\Administrator\Desktop>pip --help

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  zip                         DEPRECATED. Zip individual packages.
  unzip                       DEPRECATED. Unzip individual packages.
  bundle                      DEPRECATED. Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -v, --verbose               Give more output. Option is additive, and can be
                              used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log-file <path>           Path to a verbose non-appending log, that only
                              logs failures. This log is active by default at
                              C:\Users\Administrator\pip\pip.log.
  --log <path>                Path to a verbose appending log. This log is
                              inactive by default.
  --proxy <proxy>             Specify a proxy in the form
                              [user:passwd@]proxy.server:port.
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists:
                              (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert <path>               Path to alternate CA bundle.

C:\Users\Administrator\Desktop>
Dinesh Pundkar
  • 3,620
  • 1
  • 19
  • 35
  • As soon I run the downloaded exe a command prompt opens I get the same error as above. I think pip itslef is not getting installed. – codec May 18 '16 at 06:59
  • Please try this way of installing pip on windows. https://pip.pypa.io/en/stable/installing/ – Dinesh Pundkar May 18 '16 at 07:05
  • ok I tried python get-pip.py and got ` Could not find a version that satisfies the requirement pip (from versions: ) No matching distribution found for pip` – codec May 18 '16 at 07:18
  • ` Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(, 'Connection to pypi .python.org timed out. (connect timeout=15)')': /simple/pip/` – codec May 18 '16 at 08:05
  • ok I added proxy and I got `Successfully installed pip-8.1.2 setuptools-21.0.0 wheel-0.29.0` :) let me try installing a pip package now – codec May 18 '16 at 08:11
  • I get `Could not import setuptools which is required to install from a source distribution.Please install setuptools.` when I try to install package using pip install command. I am using `pip` under Scripts folder in my installation directory and it does not have setuptools. Though the previous message says setup tools have been installed. – codec May 18 '16 at 08:18
  • Please add "Python27/Scripts" dir in enviornment variable and restart the command prompt and then try – Dinesh Pundkar May 18 '16 at 08:23
  • well I deleted a folder called setuptools in installation directory and reinstalled setup tools. That did the trick I am able to install packages now. Thank you for your help! – codec May 18 '16 at 08:24
1

This is more like a comment than an answer. If your access to internet is through the proxy, i.e. you have no access to internet except establishing the proxy, then pip/pip3 won't be able to download the files. Try ping google.com if you see no response then try installing an application like proxyfire to enforce the proxy settings across the entire system.

Hope it helps.

0

Error 10060 means it cannot connect to the remote peer.
You probably want to check if ping and telnet work through port 80. If only ping works and telnet doesn't, then HTTP port 80 is closed on your machine.

You can try to connect through another tool such as ncat

I know there exists a function in the urllib2 library that will allow you to handle proxy support which is something like:

import urllib2 proxy_handle = urllib2.ProxyHandler({"http":"http://123.124.125.126:80"}) opener = urllib2.build_opener(proxy_handle) urllib2.install_opener(opener)