-
Notifications
You must be signed in to change notification settings - Fork 8
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
Error when system pip packages don't match Ansible-DK pip packages #63
Comments
This is strange. Without that env set from python shell if you run |
adding it to the path with ENV does move it further up the path list, so maybe that makes the difference? |
Probably. What does the rest of your sys.path look like? Without using Ansible-DK, I get
Using Ansible-DK, I get:
I would think that the location of the site-packages in the second one is high enough in the order -- there are no system locations with higher priority. This has to be some system interplay with ansible -- possibly ansible is invoking some shell command somewhere specifically using /usr/bin/python instead of using whichever is resolved by path first. |
I made a quick little ansible module to check the pythonpath in the context of ansible. Here's my output without PYTHONPATH set:
And here's with PYTHONPATH set to
Same paths but the two I specify get moved higher up the list |
bingo. https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/elasticache.py#L1 |
when I set my module to use the system python I still got the same output above. I'm thinking go ahead and set the pythonpath as it doesn't seem to negatively impact anything else and does seem to solve this issue |
Ran into this error when running some ansible code that uses the ansible elasticache module (http://docs.ansible.com/ansible/elasticache_module.html)
fatal: [elc-m]: FAILED! => {"changed": false, "failed": true, "msg": "boto required for this module"}
Ansible-DK comes with boto 2.36.0 pre-installed at /opt/ansible-dk/embedded/lib/python2.7/site-packages/boto/, and is seen via Ansible-DK's pip:
I have not installed pip modules to system python, trying to leave that as clean as possible, system python does not have boto installed:
To work around this, I added an environment variable to the set returned by
eval "$(ansible-dk shell-init bash)"
:export PYTHONPATH="/opt/ansible-dk/embedded/lib/python2.7/site-packages"
This let my Ansible-DK installation find the boto installation included with the embedded python.
The text was updated successfully, but these errors were encountered: