Sunday, January 08, 2017

Python 2.7 Installation and SSL errors

Working to get some python code finished and ran into an issue with seems to have plagued python for somne time.

When building python as you would often do to be able to use later versions in Redhat, as you cannot update the original Python as it breaks yum and many other Redhat tools you need to look at doing local installs. For the little bit of space and then using virtualenv, this is probably for many things a better option.

When installing Python 2.7.13 from source on Redhat it doesn't install the SSL modules. Ha, I don't need SSL, I am not connecting to any SSL. Sorry to tell you the bad new but pip now connects to https to access the repository, really it has for some time.

What does one do to resolve this?
What needs to be done is make sure the SSL development libraries are there as their absence leaves you without SSL which you need for pip. Of course, that means you cannot install packages directly fro the python repository. Agggghhh

Firstly you download and prepare to install python as local install, lots of good instructions out there.

Next, you make sure the zlib1g is installed as well as openssl-develop packages. Unless it's a very minimal installation, it should have the OpenSSL  runtime stuff there already.

Untar the python and cd into the unpacked source code
Go to Module and open the Setup file and if it's not there run configure and make and it is generated.
Now as per this StackOverflow question. You need to uncomment some SSL text

_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

Now make and make altinstall to where your local installation is

The path to verify SSL has changed in 2.7.13, possibly earlier editions as well

python /usr/local/lib/python2./test/

This might become helpful to someone down the track as it seems a ridiculous issue to still be a problem for this long.

See ya round


No comments: