2

I am trying to install different packages using python pip, but i get this error:

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'

I some workaroundI founr I need to install pyoepnssl.

When I try to manually install pyopenssl I get the error:

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

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

I don't know if I am missing some library.

Any advice.

Thanks in advance

Community
  • 1
  • 1
joselegit
  • 533
  • 1
  • 14
  • 35

1 Answers1

5
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

Method 2:

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

Executing above line may fix your problem.

Sayali Sonawane
  • 12,289
  • 5
  • 46
  • 47
  • I can't use PIP. I get this error **cnx.set_tlsext_host_name(server_hostname) AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name**. When I try to install any package – joselegit Oct 17 '16 at 17:25
  • Using easy_install I get the error **SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version**, when I try to user easy_install – joselegit Oct 17 '16 at 20:00
  • checking the version of openssl I found when I use **rpm -qi openssl* show the version 0.9.8e and when I use **openssl version** I get the version 1.0.2j. I don't know if this are causing all the issues – joselegit Oct 18 '16 at 20:14