How to enable OpenSSL support in an alternate install of Python 2.5.1?
Question: Some background info:  
I'm trying to run a server program in `python 2.5.1` (the version the server
was written for and tested on). The program needs the OpenSSL library for some
of its functions. I installed python 2.5.1 from source as the yum repository
for the Amazon Linux instance I'm running on does not have the version of
python I need.

When I try to run the server with python 2.5.1 I get the following import
error:

    
    
    Traceback (most recent call last):  
    File "<stdin>", line 1, in <module>  
    ImportError: No module named OpenSSL
    

I know that the OpenSSL libraries are installed as I can import them into
Python 2.6 (the version of python installed by yum). It's just that my python
2.5.1 installation can't see them.

I have also installed pyOpenSSL via yum with no luck.


Answer: installed python libraries are specific to a particular version. so the
pyOpenSSL you installed from yum will be for the system python. you need to
install a separate instance of pyOpenSSL for the alt-installed 2.5 python.

if you use python2.5 to install distutils then you'll find that you have an
`easy_install-2.5` that you can use: `easy_install-2.5 pyopenssl` (or
similar). but note that may also install a new version of `easy_install`,
overwriting the existing one for the system python (if you have one). to use
distutils with the existing package use `easy_install-2.7` (if it's python
2.7).

does that make sense? basically, each python is distinct and needs its own set
of libraries. in contrast, easy_install is installed globally, but there is a
version-specific copy of easy_install for each python...!

if you want to avoid the mess with easy_install, you can use virtualenv.
create a new environment for 2.5, enable that, and you can install the
pyopenssl in there (using the easy_install from the environment). that may
sound more complicated if you've never ysed virtualenv, but if you give it a
little time to understand it will likely work out better in the long-term.

