# pip module doing incomplete installation on Raspberry Pi

**URL:** <https://forum.ansible.com/t/pip-module-doing-incomplete-installation-on-raspberry-pi/23528>\
**Category:** Ansible Project\
**Created:** [January 23, 2017, 3:07am UTC](https://forum.ansible.com/t/pip-module-doing-incomplete-installation-on-raspberry-pi/23528 "2017-01-23T03:07:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Trasuk](https://avatars.discourse-cdn.com/v4/letter/g/49beb7/32.png) [@Greg\_Trasuk](https://forum.ansible.com/u/Greg_Trasuk)\
**Post date:** [January 23, 2017, 3:07am UTC](https://forum.ansible.com/t/pip-module-doing-incomplete-installation-on-raspberry-pi/23528/1 "2017-01-23T03:07:59Z")

</div>

I’m seeing a funny behavior when using Ansible to manage an installation on a Raspberry Pi running Raspbian Jessie lite.

The playbook includes the following, to install a Python program called ‘power-cycle’ from a GitHub repo:

- hosts: power\_controllers  
tasks:
- name: Install the power cycle utility  
pip: name=‘git+http://github.com/burlington-arc/power-cycle.git#egg=power-cycle’

After running the playbook, the ‘power-cycle’ command is available and works fine. However, if I run it after a reboot, it fails with a ‘distribution not found’:

pi@barcpi004:~ $ power-cycle  
Traceback (most recent call last):  
File “/usr/local/bin/power-cycle”, line 5, in   
from pkg\_resources import load\_entry\_point  
File “/usr/lib/python2.7/dist-packages/pkg\_resources.py”, line 2876, in   
working\_set = WorkingSet.\_build\_master()  
File “/usr/lib/python2.7/dist-packages/pkg\_resources.py”, line 449, in \_build\_master  
ws.require( **requires** )  
File “/usr/lib/python2.7/dist-packages/pkg\_resources.py”, line 745, in require  
needed = self.resolve(parse\_requirements(requirements))  
File “/usr/lib/python2.7/dist-packages/pkg\_resources.py”, line 639, in resolve  
raise DistributionNotFound(req)  
pkg\_resources.DistributionNotFound: power-cycle==1.0.2

In other words, the installation with ‘pip’ didn’t survive a reboot.

If I install the same egg from the command line, it all works fine and survives the reboot.

It appears that the pip module is doing some kind of incomplete or perhaps temporary installation. After the playbook has run, the ‘/usr/local/lib/python2.7/dist-packages/’ dir looks like this:

pi@barcpi004:~ $ ls /usr/local/lib/python2.7/dist-packages/  
daemon lockfile  
docutils lockfile-0.12.2.dist-info  
docutils-0.13.1.dist-info power-cycle.egg-link  
easy-install.pth python\_daemon-2.1.2.dist-info

…whereas, after running ‘sudo pip install git+http://github.com/burlington-arc/power-cycle.git#egg=power-cycle’ from the command line, it looks like:

pi@barcpi004:~ $ ls /usr/local/lib/python2.7/dist-packages/  
daemon lockfile-0.12.2.dist-info  
docutils power\_cycle-1.0.2.egg-info  
docutils-0.13.1.dist-info power-cycle.egg-link  
easy-install.pth powerpi  
lockfile python\_daemon-2.1.2.dist-info

…which has a directory for ‘powerpi’, which has the required scripts in it.

Any ideas? Am I missing something with the ‘pip’ task?

Thanks in advance,

Greg

---

<div class="post-metadata">

**Author:** ![Greg\_Trasuk](https://avatars.discourse-cdn.com/v4/letter/g/49beb7/32.png) [@Greg\_Trasuk](https://forum.ansible.com/u/Greg_Trasuk)\
**Post date:** [January 23, 2017, 7:58pm UTC](https://forum.ansible.com/t/pip-module-doing-incomplete-installation-on-raspberry-pi/23528/2 "2017-01-23T19:58:31Z")

</div>

Forgot to mention - Ansible 2.2.1.0 on the control machine, pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7) on the Pi.

---

<div class="post-metadata">

**Author:** ![Greg\_Trasuk](https://avatars.discourse-cdn.com/v4/letter/g/49beb7/32.png) [@Greg\_Trasuk](https://forum.ansible.com/u/Greg_Trasuk)\
**Post date:** [January 23, 2017, 8:47pm UTC](https://forum.ansible.com/t/pip-module-doing-incomplete-installation-on-raspberry-pi/23528/3 "2017-01-23T20:47:11Z")

</div>

Found the answer:

The ‘pip’ module defaults to installing applications in ‘editable’ mode. Not sure why that doesn’t survive a reboot, but if I change the ansible script to:

- hosts: power\_controllers  
tasks:
- name: Install the power cycle utility  
pip:  
name: ‘git+http://github.com/burlington-arc/power-cycle.git#egg=power-cycle’  
editable: false

…It works correctly, and the installation survives reboot.

Greg.
