Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX - debops command fails with Ansible from Homebrew #159

Closed
hbokh opened this issue Jul 31, 2016 · 4 comments
Closed

OSX - debops command fails with Ansible from Homebrew #159

hbokh opened this issue Jul 31, 2016 · 4 comments

Comments

@hbokh
Copy link

hbokh commented Jul 31, 2016

On Mac OS X, the command debops seems to work only when Ansible is installed from pip.
With Ansible installed through Homebrew, this is the error:

> debops
Traceback (most recent call last):
  File "/usr/local/bin/debops", line 36, in <module>
    import ansible
ImportError: No module named ansible

It works when uninstalling from Homebrew and use pip instead, but I wonder, is there any way around this, without installing Ansible from pip?

@drybjed
Copy link
Member

drybjed commented Jul 31, 2016

I'm not really sure. IIRC, Homebrew and pip environments on MacOS X are separate and cannot be crossed over without messing stuff up. Perhaps any MacOS X users could clarify this?

@xorgic
Copy link

xorgic commented Aug 1, 2016

Hi hbokh!

Debops and Ansible from Homebrew works fine, the problem is that python on OSX expects the modules to placed in specific folders by default, but you can add to the list of folders that python should look into when trying to resolve modules during the import.

Oh well, less talk more action, place the code below into your bashrc or just execute it before debops command and it will work.

export PYTHONPATH="/usr/local/Cellar/ansible/2.1.0.0/libexec/lib/python2.7/site-packages:/usr/local/Cellar/ansible/2.1.0.0/libexec/vendor/lib/python2.7/site-packages:$PYTHONPATH"

Please note that the bash version of OSX is old, and that some Debops feature require v4.3 mainly the PKI, you can upgrade bash with Homebrew, and depending on you version of OSX you might have to modify some more in order to get it working.

For El Capitan or above you will have to disable the SIP in order to link the new bash.
Ref to disable SIP

@hbokh
Copy link
Author

hbokh commented Aug 1, 2016

Thank you @xorgic - that did the trick!
Uninstalled Ansible from pip; reinstalled from Homebrew; set PYTHONPATH; debops works (I was on bash v4.3.46 on MacOS already).

Might be handy to put somewhere in your sweet documentation though.

@hbokh hbokh closed this as completed Aug 1, 2016
@drybjed
Copy link
Member

drybjed commented Aug 1, 2016

@xorgic If you want, you could add a file detailing the needed steps on MacOS X in the debops/debops-tools repository, in the docs/ directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants