# How to update Jinja2 for Ansible

**URL:** <https://forum.ansible.com/t/how-to-update-jinja2-for-ansible/30492>\
**Category:** Ansible Project\
**Created:** [June 5, 2019, 6:47am UTC](https://forum.ansible.com/t/how-to-update-jinja2-for-ansible/30492 "2019-06-05T06:47:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylvia\_Possenau](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sylvia\_Possenau](https://forum.ansible.com/u/Sylvia_Possenau)\
**Post date:** [June 5, 2019, 6:47am UTC](https://forum.ansible.com/t/how-to-update-jinja2-for-ansible/30492/1 "2019-06-05T06:47:22Z")

</div>

Hi,

regarding this issue: [https://github.com/ansible/ansible/issues/57311](https://github.com/ansible/ansible/issues/57311)

I’ve tried all the suggested ways of upgrading Jinja including the last one:

```auto
$ python -m pip install -U jinja2

Pip and the python pip upgrade both think I installed Jinja2 version 2.10.1 which has the required 'equalto' function. But when I execute the playbook it continues to fail and the version command still continues to return 2.7.2. which is th eversion it is not implemented yet.

$ python -c 'from jinja2 import __version__ ; print( __version__ )'

So how/where can I configure the correct version to use for ansible?

Kind Regards
Sylvia

```

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [June 6, 2019, 7:35am UTC](https://forum.ansible.com/t/how-to-update-jinja2-for-ansible/30492/2 "2019-06-06T07:35:04Z")

</div>

I’m no expert in these things but I suspect you may have upgraded the version of jinja2 in your user’s pip library, but when ansible runs it is picking up the version installed for all users - the ‘system’ version.

I’m not sure how exactly you resolve this. If you don’t have root/sudo access and can’t upgrade the system version of jinja2 then maybe you can install all of ansible in your users’ pip library, which I think will also pull in the newer version of jinja2.

Another alternative might be to set up a python venv, which you can then install whatever versions you need into, and run ansible from inside the venv.

It’s not something I do myself (I prefer to try and have one python and set of libraries for the whole virtual machine), so I can’t offer advice on setting up the venv.

Hopefully the above will at least give you some ideas for things to try.

Jon
