# how to activate virtualenv on remote host

**URL:** <https://forum.ansible.com/t/how-to-activate-virtualenv-on-remote-host/37628>\
**Category:** Ansible Project\
**Created:** [February 6, 2023, 9:29pm UTC](https://forum.ansible.com/t/how-to-activate-virtualenv-on-remote-host/37628 "2023-02-06T21:29:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuel\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/e/b3f665/32.png) [@Emanuel\_Gonzalez](https://forum.ansible.com/u/Emanuel_Gonzalez)\
**Post date:** [February 6, 2023, 9:29pm UTC](https://forum.ansible.com/t/how-to-activate-virtualenv-on-remote-host/37628/1 "2023-02-06T21:29:52Z")

</div>

Hi all, i try activate an virtualenv on remote host but not work.

I see this error:

fatal: [wc2-prod]: FAILED! =\> {  
“ansible\_facts”: {  
“discovered\_interpreter\_python”: “/usr/bin/python”  
},  
“changed”: true,  
“cmd”: “source env/bin/activate”,  
“delta”: “0:00:00.004889”,  
“end”: “2023-02-06 20:45:55.637264”,  
“invocation”: {  
“module\_args”: {  
“\_raw\_params”: “source env/bin/activate”,  
“\_uses\_shell”: true,  
“argv”: null,  
“chdir”: “/opt/wc2\_3.0/”,  
“creates”: null,  
“executable”: null,  
“removes”: null,  
“stdin”: null,  
“stdin\_add\_newline”: true,  
“strip\_empty\_ends”: true,  
“warn”: false  
}  
},  
“msg”: “non-zero return code”,  
“rc”: 127,  
“start”: “2023-02-06 20:45:55.632375”,  
“stderr”: “/bin/sh: 1: source: not found”,  
“stderr\_lines”: [  
“/bin/sh: 1: source: not found”  
],  
“stdout”: “”,  
“stdout\_lines”:   
}

This is the tasks:

- name: “Activating env”  
shell: . env/bin/activate  
args:  
chdir: ‘{{ webpath }}’

any ideas??
