As a Windows user, I can't install Ansible with pip

First of all, I started using the Roots framework about 3 weeks ago and had problems with the installation of the various tools needed to run Roots.

One of the biggest problems was the fact that Windows always tried to install the latest version of Ansible, which apparently caused trouble with the latest version of Roots. So I scoured the forums for a solution and came across a post which suggested to install Ansible with pip, like so:

# echo "Adding Ansible repository..."
# sudo apt-add-repository -y ppa:ansible/ansible
# echo "Updating system..."
# sudo apt-get -y update
# echo "Installing Ansible..."
# sudo apt-get -y install ansible
echo "Installing pip..."
sudo sudo apt-get -y install python-pip
echo "Installing Ansible with pip..."
sudo pip install ansible==''
echo "Installing markupsafe with pip..."
sudo pip install markupsafe

It worked fine until today when I halted and destroyed the Virtual Machine using vagrant halt and vagrant destroy and tried to boot it up again using vagrant up. It showed me these errors:

==> default: python-wheel python3-pkg-resources ==> default: 0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded. ==> default: Need to get 21.9 MB of archives. ==> default: After this operation, 48.0 MB of additional disk space will be used. ==> default: Do you want to continue? ==> default: [Y/n] ==> default: Abort. ==> default: Installing Ansible with pip... ==> default: sudo: pip: command not found ==> default: sudo: pip: command not found ==> default: Running Ansible Playbooks ==> default: /tmp/vagrant-shell: line 48: ansible-playbook: command not found The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

Iā€™m really not sure where to go from here. Has anyone experienced any issues like these ? If so, how did you fix them ? Thanks in advance!

That temporary workaround was applied to in roots/trellis#613 (but edited sudo sudo apt-get... to just be sudo apt-get...).

Did it pause and wait for input on the ==> default: Do you want to continue? That would be surprising, given the -y flag on the apt-get.

You might- run vagrant provision to simply try again. Sometimes there are connectivity issues when pulling from package managers and it works to try again later.

Otherwise, you could probably just vagrant ssh and manually run sudo apt-get -y install python-pip in the VM, then exit out and run vagrant provision.

1 Like

It worked! Thanks a lot! I did as you said, I accessed the VM with vagrant ssh, manually installed python-pip and ran vagrant provision afterwards. I had to update Virtualbox in the process but in the end everything was up and running smoothly.

So thanks again!

1 Like