pymongo installed but import fails
Question: CentOS 5.8 ships with Python 2.4.3. I installed pymongo using command: sudo
pip install pymongo (after installing pip with easy_install after installing
python-pip...typical CentOS, nothing works out of the box).

The install appears to work, I get the messages:

    
    
        Successfully installed pymongo
        Cleaning up...
    

Then, when I run import pymongo, I get this:

ImportError: No module named pymongo

I followed the standard pymongo install procedure so pymongo definitely
doesn't work on CentOS. Anybody know of a workaround to get this working? It
seems yet again, a hack is required to make CentOS support basic functionality
every other Linux distro supports out of the box....


Answer: Since you didn't specify you need to use the default CentOS Python install, I
would highly recommend using virtualenv to get the support you want. CentOS
requires that old version of Python, and we have to work around it at my
business as well.

Grab the latest Python, and build from source. Make sure any SSL devel
libraries are installed through Yum.

    
    
    ./configure --prefix=/home/user/custompython
    make && make install
    

Grab virtualenv.py from
<https://raw.github.com/pypa/virtualenv/master/virtualenv.py> and run that
script from your custom python install

    
    
    /home/user/custompython/bin/python virtualenv.py -P /home/user/custompython/bin/python /home/user/pythonENV
    export PYTHON_HOME=/home/user/pythonENV/
    export PATH=/home/user/pythonENV/bin/:$PATH
    pip install pymongo
    

Of course, adding the path modifications to .bashrc is helpful. Now you can
install anything you want without worrying about the very old 2.4.3 that
CentOS ships with. This is the exact setup I have with our CentOS 5.8 system,
and it is very helpful.

