RPiAwesomeness
RPiAwesomeness

Reputation: 5159

Download error on http://pypi.python.org/simple/PACKAGE: [Errno -5] No address associated with hostname - Python Library HTTPLib Issue?

I'm trying to download some packages (currently, the google API) via pip - but I'm getting this response:

pi@raspberrypi ~ $ sudo easy_install google-api-python-client
Searching for google-api-python-client
Best match: google-api-python-client 1.3.1
Processing google_api_python_client-1.3.1-py2.7.egg
google-api-python-client 1.3.1 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/google_api_python_client-1.3.1-py2.7.egg
Processing dependencies for google-api-python-client
Searching for uritemplate>=0.6
Reading http://pypi.python.org/simple/uritemplate/
Download error on http://pypi.python.org/simple/uritemplate/: [Errno -5] No address associated with hostname -- Some packages may not be found!
Reading http://pypi.python.org/simple/uritemplate/
Download error on http://pypi.python.org/simple/uritemplate/: [Errno -5] No address associated with hostname -- Some packages may not be found!
Couldn't find index page for 'uritemplate' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Download error on http://pypi.python.org/simple/: [Errno -5] No address associated with hostname -- Some packages may not be found!
No local packages or download links found for uritemplate>=0.6
error: Could not find suitable distribution for Requirement.parse('uritemplate>=0.6')

Now, I figured I'd ask here instead of on RPi.SE since this seems to have been asked and answered here several times already. Now, normally, that would constitute not asking again - but none of these solutions have helped.

I've looked at

just to name a few.

Several of these solutions mention a proxy issue causing this error - however, that isn't my problem, as I don't have a proxy and my $http_proxy is null:

pi@raspberrypi ~ $ echo $http_proxy

pi@raspberrypi ~ $ 

Another issue that was mentioned was the lack of the proper SSL version and the solution given was to install pip 1.2.1...now that seems a bit outdated. Do I need to install a certain version of OpenSSL/pip?

I did install pip 1.2.1, I had 1.1.1 previously (the package from the Raspbian repositories) but got the same error.

Any idea what might be causing this?

EDIT: Is it an HTTPLib error?

I believe that this is an issue with the Python installation on my Raspberry Pi, because I'm getting the same error ([Errno -5] No address associated with hostname) in some other code of mine using the httplib python library. An issue in the httplib library would definitely explain this issue.

Note, curl, wget, and lynx all work just fine.

Upvotes: 1

Views: 10044

Answers (1)

RPiAwesomeness
RPiAwesomeness

Reputation: 5159

I solved the issue with a work-around, as per this post on the Raspberry Pi Forums.

I had to edit the create_connection() function in the /usr/lib/python2.7/socket.py file to resolve the hostname to an IP first:

Original Code:

def create_connection(.....)

host, port = address
err = None
for res in getaddrinfo(host, port, 0, SOCK_STREAM):

Edited Code:

def create_connection(.....)

host, port = address
err = None
hostip = gethostbyname(host)
for res in getaddrinfo(hostip, port, 0, SOCK_STREAM):

Upvotes: 2

Related Questions