pip install bs4 giving _socketobject error
<p>I am trying to install BeautifulSoup4 using the command <code>pip install BeautifulSoup4</code>, as per the bs documentation here:</p>

<p><a href="https://www.crummy.com/software/BeautifulSoup/#Download">https://www.crummy.com/software/BeautifulSoup/#Download</a></p>

<p>I am using Mac OS X 10.7.5, and python 2.7.12</p>

<p>When I run the command in Terminal I get the error:</p>

<pre><code>AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'
</code></pre>

<p>Can anyone suggest what I'm doing wrong?  Thanks in advance.</p>

<p>EDIT:
In light of comments I have tried to run <code>sudo pip install pyopenssl</code> however I get the same 'socketobject' error.</p>

<p>See <a href="http://stackoverflow.com/a/31576259/3579910">http://stackoverflow.com/a/31576259/3579910</a>:</p>

<p>Try:</p>

<pre><code>sudo apt-get purge python-openssl
sudo apt-get install libffi-dev
sudo pip install pyopenssl
</code></pre>

<p>Apparently you can't vote duplicate if there is an open bounty.</p>

<p>Background:</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p><a href="https://github.com/passslot/passslot-python-sdk/issues/1" rel="nofollow">Source</a></p>

<hr>

<p>On Mac, you can get homebrew to replace the apt-get calls: follow the instructions for installing <a href="http://stackoverflow.com/a/19688479/3579910">homebrew</a>.</p>

python python-2.7 beautifulsoup