Error installing any module using pip, but easy_install works

I get this error whenever I try to install any module using pip, but easy_install works fine. I do not have proxies configured on my Ubuntu 12.04 computer. He used to work fine, just didn't know how he suddenly stopped working.

This is the error I get when 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' 
+3
python sockets pyopenssl
source share
1 answer

I found a potential solution here . Here's the corresponding quote:

β€œThis happened because Ubuntu 12.04 (this is my server OS) has an old pyOpenSSL library that does not accept the 'set_tlsext_host_name' attribute. To fix, you need to add the dependency pyOpenSSL > = 0.13. In Ubuntu, use pip to update pyOpenSSL , you also need to install libffi-dev and remove python-openssl on 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 does not work for you.

+7
source share

All Articles