# pip install list of packages

**URL:** <https://forum.ansible.com/t/pip-install-list-of-packages/33969>\
**Category:** Ansible Project\
**Created:** [October 6, 2020, 2:34pm UTC](https://forum.ansible.com/t/pip-install-list-of-packages/33969 "2020-10-06T14:34:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 6, 2020, 2:34pm UTC](https://forum.ansible.com/t/pip-install-list-of-packages/33969/1 "2020-10-06T14:34:17Z")

</div>

Hi

If I'm using pip with name being a list of packages, for instance:

- name: Install stuff  
&nbsp;&nbsp;pip:  
&nbsp;&nbsp;&nbsp;&nbsp;name:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- pyyaml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- natsort  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- passlib

Then the module will do "pip install pyyaml natsort passlib", and not:

pip install pyyaml  
pip install natsort  
pip install passlib

Is this assumption correct?

---

<div class="post-metadata">

**Author:** ![Idan\_Melamed](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@Idan\_Melamed](https://forum.ansible.com/u/Idan_Melamed)\
**Post date:** [October 8, 2020, 9:16am UTC](https://forum.ansible.com/t/pip-install-list-of-packages/33969/2 "2020-10-08T09:16:44Z")

</div>

Hi Dick,

I’m doing this:

- name: Install Python packages  
pip:  
name: “{{ item.name }}”  
version: “{{ item.version }}”  
executable: pip2  
become: yes  
with\_items:
- { name: ‘alembic’, version: ‘1.1.0’ }
- { name: ‘aniso8601’, version: ‘7.0.0’ }
- { name: ‘anyjson’, version: ‘0.3.3’ }
- { name: ‘articleDateExtractor’, version: ‘0.20’ }

And it pip installs every one of them separately.

---

<div class="post-metadata">

**Author:** ![Idan\_Melamed](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@Idan\_Melamed](https://forum.ansible.com/u/Idan_Melamed)\
**Post date:** [October 8, 2020, 11:46am UTC](https://forum.ansible.com/t/pip-install-list-of-packages/33969/3 "2020-10-08T11:46:52Z")

</div>

It seems that I was wrong.  
Ansible runs each of my iterations as a different command because I’m using with\_items.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 8, 2020, 12:04pm UTC](https://forum.ansible.com/t/pip-install-list-of-packages/33969/4 "2020-10-08T12:04:20Z")

</div>

Yes, I noticed that.  
So that is the distinction then.  
I guess this is similar to the apt/package/etc modules, where you are  
encouraged to use a list for 'name' so that the package manager can  
install the whole lot in one go.

thx
