Vagrant: ansible_local: bash: line 5: pip: command not found

Created on 4 Jul 2019  ยท  10Comments  ยท  Source: hashicorp/vagrant

Vagrant version

Vagrant 2.2.5

Host operating system

Ubuntu 18.04
Ubuntu 19.04

Guest operating system

bento/ubuntu-18.04

Vagrantfile

config.vm.box = 'bento/ubuntu-18.04'

config.vm.provision 'ansible_local' do |ansible|
  ansible.playbook = 'playbook.yml'
  ansible.install_mode = 'pip'
  ansible.version = '2.8.1'
  ansible.extra_vars = Object.new
  ansible.compatibility_mode = '2.0'
end

Debug output

bash: line 5: pip: command not found

Expected behavior

Pip should be successfully installed

Actual behavior

Pip not found

PS: Downgrade to Vagrant 2.2.4 works.

bug provisioneansible_local regression

Most helpful comment

Setting _ansible.pip_install_cmd_ in the ansible_local configuration also worked around the issue for me.

  config.vm.provision "ansible_local" do |ansible|
    ...
    ansible.pip_install_cmd = "curl https://bootstrap.pypa.io/get-pip.py | sudo python"
    ...
  end

All 10 comments

I can confirm this issue.

Hi, we see this as well; see https://gitlab.com/aegir/aegir-dev-vm/issues/16 comparing Vagrant 2.2.4 to Vagrant 2.2.5 debug logs. Something fishy is going on with the execution of the curl command to install pip in the ansible_local provisioner. Vagrant appears to be trying execute the string #<Object:0x0000000102de6130> rather than curl https://bootstrap.pypa.io/get-pip.py | sudo python -- my ruby's not good enough to dig any deeper than that for now, I'm afraid.

Yep, I just had this, reverted to Vagrant 2.2.4 and it worked without issues.

Hi, how do you revert to vagrant 2.2.4?

Just uninstall and install the previous version. You may need to fix your plugins as well. There is a link on the download page to download the previous versions

Looking at the release notes, the issue that may have introduced this is: #9584

Setting _ansible.pip_install_cmd_ in the ansible_local configuration also worked around the issue for me.

  config.vm.provision "ansible_local" do |ansible|
    ...
    ansible.pip_install_cmd = "curl https://bootstrap.pypa.io/get-pip.py | sudo python"
    ...
  end

i have done a fix for this issue here: https://github.com/hashicorp/vagrant/pull/11096
that could be merged and rolled forward into the ver 2.2.6.

It would be nice to have a review on that. anyone here? thx. :)

Hey all! It looks like this was due to a typo when finalizing ansibles guest config. I've made a pull request to fix this: https://github.com/hashicorp/vagrant/pull/11098. It should be fixed in the next release. For now you can get around this by following the fix mentioned by @Troym . Thanks!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefanScherer picture StefanScherer  ยท  3Comments

rrzaripov picture rrzaripov  ยท  3Comments

OtezVikentiy picture OtezVikentiy  ยท  3Comments

luispabon picture luispabon  ยท  3Comments

barkingfoodog picture barkingfoodog  ยท  3Comments