pip install in a virtual env

89 views
Skip to first unread message

Pedro Ferro

unread,
Feb 22, 2017, 12:55:13 PM2/22/17
to Ansible Project
Hi,

First of all I'm not an IT guy so you have to excuse me for any basic questions that I probably make.


I'm trying to replicate an installation of CKAN through Ansible in a Ubuntu 14.04 virtual machine (I'm beyond a proxy)

Because I'm quiet ignorant in Ansible, I use the "shell" command to do almost everything (I imagine that is quiet wrong but it has worked  so far...)

I'm trying to replicate this comand that I make via terminal:

. /usr/lib/ckan/default/bin/activate # activate virtualenv


pip install
-e 'git+https://github.com/ckan/ckan...@ckan-2.5.3#egg=ckan'

pip install
-r /usr/lib/ckan/default/src/ckan/requirements.txt


In an ansible file I have like this:

---
- hosts: localhost
  sudo
: yes




  tasks
:
   
- name: activate virtualenv
      shell
: . /usr/lib/ckan/default/bin/activate


   
- name: export https proxy
      shell
: export https_proxy=’https://10.0.32.6:8080’


   
- name: install ckan 2.5.3
      shell
: pip install -e 'git+https://github.com/ckan/ckan...@ckan-2.5.3#egg=ckan'


   
- name: install requirements.txt
      shell
: pip install -r /usr/lib/ckan/default/src/ckan/requirements.txt

and got this error:

PLAY [localhost]
***************************************************************





TASK [setup]
*******************************************************************


ok: [localhost]



 



TASK [activate virtualenv]
*****************************************************



changed: [localhost]



 



TASK [export https proxy]
******************************************************



changed: [localhost]



 



TASK [install ckan 2.5.3]
******************************************************



fatal: [localhost]: FAILED! =>
{"changed": true, "cmd": "pip install -e
'git+https://github.com/ckan/ckan...@ckan-2.5.3#egg=ckan'"
,
"delta": "0:00:00.372384", "end":
"2017-02-22 17:11:20.423442", "failed": true,
"rc": 1, "start": "2017-02-22 17:11:20.051058",
"stderr": "fatal: unable to access
'https://github.com/ckan/ckan.git/': Failed to connect to github.com port 443:
No route to host"
, "stdout": "Obtaining ckan from
git+https://github.com/ckan/ckan...@ckan-2.5.3#egg=ckan\n  Cloning https://github.com/ckan/ckan.git (to
ckan-2.5.3) to ./src/ckan\n  Complete
output from command /usr/bin/git clone -q https://github.com/ckan/ckan.git
/tmp/ckan/install/ansible/playbooks/src/ckan:\n
\n----------------------------------------\nCleaning up...\nCommand
/usr/bin/git clone -q https://github.com/ckan/ckan.git
/tmp/ckan/install/ansible/playbooks/src/ckan failed with error code 128 in
None\nStoring debug log for failure in /home/pf/.pip/pip.log"
,
"stdout_lines": ["Obtaining ckan from
git+https://github.com/ckan/ckan...@ckan-2.5.3#egg=ckan"
, "  Cloning https://github.com/ckan/ckan.git (to
ckan-2.5.3) to ./src/ckan"
, "
Complete output from command /usr/bin/git clone -q
https://github.com/ckan/ckan.git
/tmp/ckan/install/ansible/playbooks/src/ckan:"
, "  ",
"----------------------------------------", "Cleaning up...",
"Command /usr/bin/git clone -q https://github.com/ckan/ckan.git /tmp/ckan/install/ansible/playbooks/src/ckan
failed with error code 128 in None"
, "Storing debug log for failure
in /home/pf/.pip/pip.log"
], "warnings": []}



            to
retry, use: --limit
@/tmp/ckan/install/ansible/playbooks/install_software_ckan253.retry



 



PLAY RECAP
*********************************************************************



localhost                  : ok=3    changed=2  
unreachable
=0    failed=1  


 I try some variations  in the ansible file, but the result is always the some.

Thanks in advance,
Pedro

Nehal J Wani

unread,
Feb 26, 2017, 6:08:30 AM2/26/17
to ansible...@googlegroups.com
Try the pip module with environment:

---
- hosts: localhost

  tasks:

    - name: install ckan 2.5.3
      pip:
        virtualenv: /usr/lib/ckan/default
      environment:
          https_proxy: http://https://10.0.32.6:8080


    - name: install requirements.txt
      pip:
        requirements: /usr/lib/ckan/default/src/ckan/requirements.txt
      environment:
          https_proxy: http://https://10.0.32.6:8080


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bbe53947-ca57-48e8-b6e7-485a9a5f3258%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Nehal J Wani

Nehal J Wani

unread,
Feb 26, 2017, 6:10:24 AM2/26/17
to ansible...@googlegroups.com, pedro...@gmail.com
Small typo in the previous reply. Here is the correct one:

---
- hosts: localhost

  tasks:

    - name: install ckan 2.5.3
      pip:
        virtualenv: /usr/lib/ckan/default
      environment:
          https_proxy: http://10.0.32.6:8080


    - name: install requirements.txt
      pip:
        requirements: /usr/lib/ckan/default/src/ckan/requirements.txt
      environment:
          https_proxy: http://10.0.32.6:8080


On Wed, Feb 22, 2017 at 11:25 PM, Pedro Ferro <pedro...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bbe53947-ca57-48e8-b6e7-485a9a5f3258%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Nehal J Wani

Pedro Ferro

unread,
Feb 27, 2017, 5:19:00 AM2/27/17
to Ansible Project, pedro...@gmail.com
Thank you so much Nehal !!
I've been stuck with this for more than 1 day...

thanks again
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.



--
Nehal J Wani
Reply all
Reply to author
Forward
0 new messages