# create virtualenv with pip modle and centos scl (rh-python36)

**URL:** <https://forum.ansible.com/t/create-virtualenv-with-pip-modle-and-centos-scl-rh-python36/29943>\
**Category:** Ansible Project\
**Created:** [March 21, 2019, 8:39pm UTC](https://forum.ansible.com/t/create-virtualenv-with-pip-modle-and-centos-scl-rh-python36/29943 "2019-03-21T20:39:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Hudec](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@Peter\_Hudec](https://forum.ansible.com/u/Peter_Hudec)\
**Post date:** [March 21, 2019, 8:39pm UTC](https://forum.ansible.com/t/create-virtualenv-with-pip-modle-and-centos-scl-rh-python36/29943/1 "2019-03-21T20:39:57Z")

</div>

Hi all,

I’m trying to solve following problem.

I need to create virtualenv for python using centos scl rh-python36

Manual way is easy, there are several way how to do that

&nbsp;&nbsp;&nbsp;&nbsp;/opt/rh/rh-python36/root/bin/python -m venv env  
&nbsp;&nbsp;&nbsp;&nbsp;. ./env/bin/activate  
&nbsp;&nbsp;&nbsp;&nbsp;pip install -U pip setuptools  
&nbsp;&nbsp;&nbsp;&nbsp;pip install -t requirements.txt

But but with ansible I’m a little bit lost.

&nbsp;&nbsp;- name: create virtualenv  
&nbsp;&nbsp;&nbsp;&nbsp;pip:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;virtualenv: "{{ haproxy\_tools\_remote\_dir }}/{{ haproxy\_tools\_version }}/env"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;virtualenv\_python: "/opt/rh/{{ haproxy\_tools\_scl\_python }}/root/bin/python"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;requirements: "{{ haproxy\_tools\_remote\_dir }}/{{ haproxy\_tools\_version }}/requirements.txt"  
&nbsp;&nbsp;&nbsp;&nbsp;tags:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- debug

The output is  
fatal: [lb01.test.host.sk]: FAILED! =\> {"changed": false, "msg": "No setuptools found in remote host, please install it first.”}

Any idea, please ?

&nbsp;&nbsp;regards  
&nbsp;&nbsp;&nbsp;&nbsp;Peter

---

<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:** [March 21, 2019, 8:50pm UTC](https://forum.ansible.com/t/create-virtualenv-with-pip-modle-and-centos-scl-rh-python36/29943/2 "2019-03-21T20:50:20Z")

</div>

I believe the problem is that the system python at /usr/bin/python doesn’t have python-setuptools installed

You would need to either install python-setuptools via yum, or set `ansible_python_interpreter` to `/opt/rh/rh-python36/root/bin/python` so that ansible is using that SCL python also.

By default ansible will use /usr/bin/python on the remote, and use that to configure the virtualenv, but configure the virtualenv to use the SCL python. So basically ansible is using 1 python to run another.
