david
david

Reputation: 6795

Pip install of a specific git commit failing via Ansible Playbook

In this example, Django-cities fails.

- hosts: localhost
  tasks:
   - name: Install Django
     pip: name=Django
   - name: Install Userena
     pip: name=django-userena
   - name: Install Django Messages
     pip: name=https://github.com/arneb/django-messages/archive/master.zip
   - name: Install Django Cities
     pip: name=git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6

error:

TASK [Install Django Cities] ***************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/pip2 install -e git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6", 
"failed": true, "msg": "\n:stderr: --editable=git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6 is not the right format; it must have #egg=Package\nYou are using pip version 8.1.2, however version 9.0.1 is available.\nYou should consider upgrading via the 'pip install --upgrade pip' command.\n"}
    to retry, use: --limit @/root/cannablr/ansible/playbooks/installdjango.retry

Is install of a git commit via pip not allowed in Ansible?

Upvotes: 1

Views: 392

Answers (1)

300D7309EF17
300D7309EF17

Reputation: 24613

You'll get the same error if you run this on the commandline:

$ pip install -e git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6
--editable=git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6 is not the right format; it must have #egg=Package

You can add an #egg=packagename to it and it'll work:

$ pip install -e git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6#egg=django-cities
Obtaining django-cities from git+https://github.com/coderholic/django-cities.git@d0163f393e7557914b3f2c6882e740537ca63fd6#egg=django-cities
  Cloning https://github.com/coderholic/django-cities.git (to d0163f393e7557914b3f2c6882e740537ca63fd6) to src/django-cities

So just add #egg=django-cities to the URL in Ansible and you'll be good.

Note I'd recommend quoting your git+https://....#egg=xyz yaml. There are a lot of magic characters in there.

Upvotes: 3

Related Questions