Bash: line 5: pip: command not found

I’m getting the exact same error running vagrant up for the first time on a new roots project on Windows 10. This hasn’t happened before on my other roots projects.

This happens through both Windows GitBash and through WSL.

Running sudo pip install ansible==2.7.5 through WSL doesn’t fix my problem.

These messages might be a clue:

The directory 'xxx/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/xxx/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

SOLUTION
https://github.com/hashicorp/vagrant/issues/10950#issuecomment-514023810

Add line to VagrantFile (line 123 in my vagrant file)
ansible.pip_install_cmd = "curl https://bootstrap.pypa.io/get-pip.py | sudo python"

1 Like