Skip to main content

 none
Unable to use pip with Python Tools RRS feed

  • Question

  • I am native Linux user and developer, but as I now use Windows 10 at work I have more than a little trouble doing what are normally the most basic tasks on my personal machine. I have created a python project from existing code but need to install the required modules for it. I try to do this as per MSDN instructions by accessing Tools->Python Tools-> Python Environments.

    The process seems rather self explanitory however, when I try to upgrade pip I recieve this error 

    Cannot fetch index base URL https://pypi.python.org/simple/


    I recieve the same error when trying to pip install NumPy

    The module I really need at the moment though id from a github repository and not on PyPi. Normally I would just install it like so 

    pip install https://github/u/r/l/file.zip

    but this returns a different error. The full output is in my pip error log just like this

    C:\Python34\lib\site-packages\pip\__main__.py run on 04/12/18 15:00:30
    Downloading/unpacking https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.7.zip
    Cleaning up...
    Exception:
    Traceback (most recent call last):
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 493, in urlopen
        body=body, headers=headers)
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 291, in _make_request
        conn.request(method, url, **httplib_request_kw)
      File "C:\Python34\lib\http\client.py", line 1090, in request
        self._send_request(method, url, body, headers)
      File "C:\Python34\lib\http\client.py", line 1128, in _send_request
        self.endheaders(body)
      File "C:\Python34\lib\http\client.py", line 1086, in endheaders
        self._send_output(message_body)
      File "C:\Python34\lib\http\client.py", line 924, in _send_output
        self.send(msg)
      File "C:\Python34\lib\http\client.py", line 859, in send
        self.connect()
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 159, in connect
        **self.conn_kw)
      File "C:\Python34\lib\socket.py", line 491, in create_connection
        for res in getaddrinfo(host, port, 0, SOCK_STREAM):
      File "C:\Python34\lib\socket.py", line 530, in getaddrinfo
        for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno 11002] getaddrinfo failed

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\adapters.py", line 327, in send
        timeout=timeout
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 543, in urlopen
        raise MaxRetryError(self, url, e)
    pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /s4w3d0ff/python-poloniex/archive/v0.4.7.zip (Caused by <class 'socket.gaierror'>: [Errno 11002] getaddrinfo failed)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
        status = self.run(options, args)
      File "C:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
        requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
      File "C:\Python34\lib\site-packages\pip\req.py", line 1197, in prepare_files
        do_download,
      File "C:\Python34\lib\site-packages\pip\req.py", line 1375, in unpack_url
        self.session,
      File "C:\Python34\lib\site-packages\pip\download.py", line 546, in unpack_http_url
        resp = session.get(target_url, stream=True)
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\sessions.py", line 468, in get
        return self.request('GET', url, **kwargs)
      File "C:\Python34\lib\site-packages\pip\download.py", line 237, in request
        return super(PipSession, self).request(method, url, *args, **kwargs)
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\sessions.py", line 456, in request
        resp = self.send(prep, **send_kwargs)
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\sessions.py", line 559, in send
        r = adapter.send(request, **kwargs)
      File "C:\Python34\lib\site-packages\pip\_vendor\requests\adapters.py", line 375, in send
        raise ConnectionError(e, request=request)
    pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /s4w3d0ff/python-poloniex/archive/v0.4.7.zip (Caused by <class 'socket.gaierror'>: [Errno 11002] getaddrinfo failed)


    Does anyone know what the problem may be?

    Thursday, April 12, 2018 8:25 PM

All replies

  • pip install https://github/u/r/l/file.zip

    I'm not sure why you felt the need to shroud the URL, but notice that your URL there is invalid.  You have "github" instead of "github.com".  Now, you may think I'm being foolish pointing out such an obvious edit, but it matches the error you got.  "getaddrinfo failed" means that it couldn't resolve the hostname.  Are you quite sure you have an internet connection, and that your DNS is configured properly?


    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Thursday, April 12, 2018 9:15 PM
  • Hi,

    Thank you for posting here.

    If you want to install the Python for your Visual Studio? you can refer to this solution.

    https://stackoverflow.com/questions/15185827/can-pip-be-used-with-python-tools-in-visual-studio

    The current forum just discuss general issues about developing applications for Windows. About how to install tool for visual studio.

    You can post the issue on visual studio forum.

    Best Regards,

    Hart


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 13, 2018 7:24 AM
    Moderator
  • Yes, I wasn't trying to shroud the url I was just giving an example. i copy and pasted the url directly from the github repo on my pip install. I am quite sure I have an internet connection,
    Friday, April 13, 2018 5:37 PM