Roots Discourse

Bash: line 5: pip: command not found

Hi,

I’m trying to setup trellis for the first time but I keep getting the below error when I run vagrant up. Can someone please tell me what I am missing as I’ve installed everything that is mentioned in the docs below.

==> default: Running provisioner: ansible_local...
    default: Installing Ansible...
    default: Installing pip... (for Ansible installation)
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

pip install  --upgrade ansible==2.7.5

Stdout from the command:



Stderr from the command:

bash: line 5: pip: command not found

I’ve installed this: https://roots.io/getting-started/docs/macos-development-environment-trellis/

Also followed these instructions including disabling FileVault: https://roots.io/trellis/docs/local-development-setup/

referencing this issue I tried to raise too: https://github.com/roots/trellis/issues/1095

What do you get if you run pip --version from your command line?

pip 19.1.1 from /Library/Python/2.7/site-packages/pip-19.1.1-py2.7.egg/pip (python 2.7)

ansible --version doesn’t work even though “Requirement already satisfied” when installing it?

jph-macbook:~ jonny$ pip install --user ansible

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

Requirement already satisfied: ansible in ./Library/Python/2.7/lib/python/site-packages (2.7.5)

Requirement already satisfied: jinja2 in ./Library/Python/2.7/lib/python/site-packages (from ansible) (2.10.1)

Requirement already satisfied: PyYAML in ./Library/Python/2.7/lib/python/site-packages (from ansible) (5.1.1)

Requirement already satisfied: paramiko in ./Library/Python/2.7/lib/python/site-packages (from ansible) (2.6.0)

Requirement already satisfied: cryptography in ./Library/Python/2.7/lib/python/site-packages (from ansible) (2.7)

Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from ansible) (18.5)

Requirement already satisfied: MarkupSafe>=0.23 in ./Library/Python/2.7/lib/python/site-packages (from jinja2->ansible) (1.1.1)

Requirement already satisfied: bcrypt>=3.1.3 in ./Library/Python/2.7/lib/python/site-packages (from paramiko->ansible) (3.1.7)

Requirement already satisfied: pynacl>=1.0.1 in ./Library/Python/2.7/lib/python/site-packages (from paramiko->ansible) (1.3.0)

Requirement already satisfied: enum34; python_version < "3" in ./Library/Python/2.7/lib/python/site-packages (from cryptography->ansible) (1.1.6)

Requirement already satisfied: cffi!=1.11.3,>=1.8 in ./Library/Python/2.7/lib/python/site-packages (from cryptography->ansible) (1.12.3)

Requirement already satisfied: six>=1.4.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography->ansible) (1.4.1)

Requirement already satisfied: asn1crypto>=0.21.0 in ./Library/Python/2.7/lib/python/site-packages (from cryptography->ansible) (0.24.0)

Requirement already satisfied: ipaddress; python_version < "3" in ./Library/Python/2.7/lib/python/site-packages (from cryptography->ansible) (1.0.22)

Requirement already satisfied: pycparser in ./Library/Python/2.7/lib/python/site-packages (from cffi!=1.11.3,>=1.8->cryptography->ansible) (2.19)

jph-macbook:~ jonny$ ansible --version

-bash: ansible: command not found

Have you tried downgrading to Vagrant 2.2.4? This link, posted in the other thread where you asked about this issue, suggests that as a solution: https://github.com/hashicorp/vagrant/issues/10950

How do I do that? I’ve tried following the instructions here https://www.jverdeyen.be/mac/downgrade-brew-cask-application/

But it keeps saying " Sorry, this commit history is taking too long to generate."

running sudo pip install ansible==2.7.5 did the trick.

Installing the latest version of ansible caused some other errors during installation, referenced here: 'PlaybookCLI' object has no attribute 'options'

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

I can confirm that downgrading to vagrant 2.2.4 got us past this issue on windows.

In WSL Ubuntu 18.04:
ansible -v 2.7.5
pip --version 9.0.1
Vituralbox -v 6.0.10

We did not add line mentioned above to the VagrantFile

This topic was automatically closed after 42 days. New replies are no longer allowed.