ERROR! Unexpected Exception: No module named jinja2.exceptions

Hello,

I am pretty new to the linux world and have been tasked with learning ansible and setting it up in our environment.

Version info:
RHEL: 6.9
Python: 2.6.6
Ansible: 2.3.1

I have intalled it via YUM, and confirmed that it exists on the system:

Host: rpm -qa | grep ansible
ansible-2.3.1.0-1.el6.noarch

However when I try and run a simple command to test the installation, I have this error:

"
ansible --version
/usr/bin/ansible:94: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
msg = e.message
ERROR! Unexpected Exception: No module named jinja2.exceptions
the full traceback was:

Traceback (most recent call last):
File “/usr/bin/ansible”, line 88, in
mycli = getattr(import(“ansible.cli.%s” % sub, fromlist=[myclass]), myclass)
File “/usr/lib/python2.6/site-packages/ansible-2.4.0-py2.6.egg/ansible/cli/init.py”, line 45, in
from ansible.vars.manager import VariableManager
File “/usr/lib/python2.6/site-packages/ansible-2.4.0-py2.6.egg/ansible/vars/manager.py”, line 32, in
from jinja2.exceptions import UndefinedError
ImportError: No module named jinja2.exceptions
"

To me this means that this module isn’t installed correctly or Ansible can’t find it somehow…

When trying to install the module using pip, I get this:

pip install jinja2
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Requirement already satisfied: jinja2 in /usr/lib/python2.6/site-packages/Jinja2-2.6-py2.6.egg

The obvious answer is that Python 2.6 may be the problem, but it shouldn’t effect a simple command like -help (or --version).

I am pretty sure that the package is installed correctly, but just maybe that Python/ansible can’t find it.

Do I need to point the python path to where the package is actually installed? Is that possible?

Thank you!

Edit:

issue was resolved by removing jinja2 through pip, and removing pip all together. Then installing jinja2 through easy_install.