# jmespath prior to running json\_query filter, yet already installed

**URL:** <https://forum.ansible.com/t/jmespath-prior-to-running-json-query-filter-yet-already-installed/32627>\
**Category:** Ansible Project\
**Created:** [April 7, 2020, 9:42pm UTC](https://forum.ansible.com/t/jmespath-prior-to-running-json-query-filter-yet-already-installed/32627 "2020-04-07T21:42:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_M](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@Bob\_M](https://forum.ansible.com/u/Bob_M)\
**Post date:** [April 7, 2020, 9:42pm UTC](https://forum.ansible.com/t/jmespath-prior-to-running-json-query-filter-yet-already-installed/32627/1 "2020-04-07T21:42:24Z")

</div>

I’m running this section of code on a proxmox ansible controller. And I still get an error saying jmespath not found.

fatal: [master]: FAILED! =\> {“msg”: “You need to install "jmespath" prior to running json\_query filter”}

In the same playbook, as a pre-task, I’ve tried to apt install python3-jmespath and python-jmespath, and still get the error.

- name: 06\_create\_vm\_template | Install jmespath and proxmoxer via pip  
pip:  
name:

- jmespath

- proxmoxer  
tags: [install]

- name: 06\_create\_vm\_template | set vm\_ip\_addrs from qm guest network-get-interfaces  
set\_fact:  
vm\_ip\_addrs: “{{ vm\_ip\_addrs + (template\_ip | from\_json | json\_query(jmesquery) | ipaddr(‘10.9.0.10/16’) | list) }}”  
vars:  
jmesquery: ‘[\*].“ip-addresses”.“ip-address”’  
loop: “{{ result.results | map(attribute=‘stdout’) | list }}”  
loop\_control:  
loop\_var: “template\_ip”  
index\_var: counter

Any ideas? Thanks!

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 7, 2020, 10:02pm UTC](https://forum.ansible.com/t/jmespath-prior-to-running-json-query-filter-yet-already-installed/32627/2 "2020-04-07T22:02:15Z")

</div>

You cannot install a dependency needed for a filter plugin, within the same playbook that requires it as a dependency. Filter plugins are loaded at ansible startup, and the imports are processed and cached by python at this time.

As such, if it is missing at the beginning of the playbook execution, it will remain missing for the remainder of the execution.

I should also indicate that the dependency for filters, must be installed on the Ansible controller, and installed using the python used to run Ansible.

---

<div class="post-metadata">

**Author:** ![Bob\_M](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@Bob\_M](https://forum.ansible.com/u/Bob_M)\
**Post date:** [April 7, 2020, 11:25pm UTC](https://forum.ansible.com/t/jmespath-prior-to-running-json-query-filter-yet-already-installed/32627/3 "2020-04-07T23:25:01Z")

</div>

Thank you Matt. I must have missed that in the documentation. I appreciate the help!!
