Error installing pyopenssl using pip
<p>I am trying to install different packages using python pip, but i get this error:</p>

<blockquote>
  <p>File
  "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/_vendor/
      cnx.set_tlsext_host_name(server_hostname) AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'</p>
</blockquote>

<p>I some workaroundI founr I need to install <a href="http://stackoverflow.com/questions/31576258/attributeerror-socketobject-object-has-no-attribute-set-tlsext-host-name">pyoepnssl</a>.</p>

<p>When I try to manually install pyopenssl I get the error:</p>

<blockquote>
  <p>gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
  -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c OpenSSL/ssl/connection.c -o
  build/temp.linux-x86_64-2.7/OpenSSL/ssl/connection.o
  OpenSSL/ssl/connection.c: In function Ã¢ssl_Connection_set_contextÃ¢:
  OpenSSL/ssl/connection.c:289: warning: implicit declaration of
  function Ã¢SSL_set_SSL_CTXÃ¢ OpenSSL/ssl/connection.c: In function
  Ã¢ssl_Connection_get_servernameÃ¢: OpenSSL/ssl/connection.c:313: error:
  Ã¢TLSEXT_NAMETYPE_host_nameÃ¢ undeclared (first use in this function)
  OpenSSL/ssl/connection.c:313: error: (Each undeclared identifier is
  reported only once OpenSSL/ssl/connection.c:313: error: for each
  function it appears in.) OpenSSL/ssl/connection.c:320: warning:
  implicit declaration of function Ã¢SSL_get_servernameÃ¢
  OpenSSL/ssl/connection.c:320: warning: assignment makes pointer from
  integer without a cast OpenSSL/ssl/connection.c: In function
  Ã¢ssl_Connection_set_tlsext_host_nameÃ¢: OpenSSL/ssl/connection.c:346:
  warning: implicit declaration of function Ã¢SSL_set_tlsext_host_nameÃ¢
  error: command 'gcc' failed with exit status 1</p>
</blockquote>

<p>I already have installed all the libraries gcc, python-devel, gcc-c++, libffi-devel, openssl-devel. I am using Red Hat 4</p>

<p>I don't know if I am missing some library.</p>

<p>Any advice.</p>

<p>Thanks in advance</p>

<pre><code>For Ubuntu:

sudo apt-get purge python-openssl
sudo apt-get install libffi-dev
sudo pip install pyopenssl

For RedHat:

sudo yum remove pyOpenSSL
sudo pip install pyopenssl
</code></pre>

<p>Method 2:</p>

<pre><code>easy_install http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.12.tar.gz
</code></pre>

<p>Executing above line may fix your problem.</p>

python linux pip redhat