I get this error whenever I try to install any module using pip, but easy_install work perfectly. I have no proxies configured in my Ubuntu 12.04 machine. Previously it was working fine, just dnt know, how it stoped working suddenly.
This is error i get, while running sudo pip install <any_package_name>:
Exception:
Traceback (most recent call last):
File "/tmp/tmpOA61D3/pip.zip/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/tmp/tmpOA61D3/pip.zip/pip/commands/install.py", line 342, in run
requirement_set.prepare_files(finder)
File "/tmp/tmpOA61D3/pip.zip/pip/req/req_set.py", line 345, in prepare_files
functools.partial(self._prepare_file, finder))
File "/tmp/tmpOA61D3/pip.zip/pip/req/req_set.py", line 290, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "/tmp/tmpOA61D3/pip.zip/pip/req/req_set.py", line 415, in _prepare_file
req_to_install, finder)
File "/tmp/tmpOA61D3/pip.zip/pip/req/req_set.py", line 376, in _check_skip_installed
finder.find_requirement(req_to_install, self.upgrade)
File "/tmp/tmpOA61D3/pip.zip/pip/index.py", line 425, in find_requirement
all_versions = self._find_all_versions(req.name)
File "/tmp/tmpOA61D3/pip.zip/pip/index.py", line 349, in _find_all_versions
index_locations = self._get_index_urls_locations(project_name)
File "/tmp/tmpOA61D3/pip.zip/pip/index.py", line 323, in _get_index_urls_locations
page = self._get_page(main_index_url)
File "/tmp/tmpOA61D3/pip.zip/pip/index.py", line 789, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/tmp/tmpOA61D3/pip.zip/pip/index.py", line 878, in get_page
"Cache-Control": "max-age=600",
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/sessions.py", line 476, in get
return self.request('GET', url, **kwargs)
File "/tmp/tmpOA61D3/pip.zip/pip/download.py", line 367, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/sessions.py", line 464, in request
resp = self.send(prep, **send_kwargs)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/adapters.py", line 370, in send
timeout=timeout
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 762, in _validate_conn
conn.connect()
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/tmp/tmpOA61D3/pip.zip/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 296, in ssl_wrap_socket
cnx.set_tlsext_host_name(server_hostname)
AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'
I found a potential solution here. Here's the relevant quote:
"That happend because Ubuntu 12.04 (that is my server's OS) has old pyOpenSSL library which not accept attribute 'set_tlsext_host_name'.
For fix that, you need to add dependence pyOpenSSL >= 0.13.
On Ubuntu for update pyOpenSSL use pip, you also need to install libffi-dev and remove python-openssl by apt."
$ sudo apt-get purge python-openssl
$ sudo apt-get install libffi-dev
$ sudo pip install pyOpenSSL
Let me know if this is unclear or if it doesn't work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With