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

ImportError: No module named hvac #561

Open
gowthamakanthan opened this issue Feb 27, 2020 · 5 comments
Open

ImportError: No module named hvac #561

gowthamakanthan opened this issue Feb 27, 2020 · 5 comments

Comments

@gowthamakanthan
Copy link

Team,

I have installed "ansible-modules-hashivault", "hvac" using pip. And created a playbook to enable a secret. Getting below import error. Have validated the packages list in the pip and all the packages are installed. I am using python 2.7. Any leads?

@jeffwecan
Copy link
Member

Howdy @gowthamakanthan, I don't see any error output attached. If you can include some additional details I'd be happy to try to help sort out what is occurring.

@drewmullen
Copy link
Member

PATH can often get messed up with ansible if youre using a virtualenv. if you are using a venv, try:

  1. deactivate (return to system python)
  2. pip remove ansible hvac ansible-modules-hashivault
  3. source <myvenv>/bin/activate (use your venv)
  4. pip install ansible hvac ansible-modules-hashivault

@gowthamakanthan
Copy link
Author

gowthamakanthan commented Feb 27, 2020 via email

@drewmullen
Copy link
Member

let me know what you think from my comment. also please be advised that python 2 is no longer a supported language, you should migrate to python3 asap: https://www.infoq.com/news/2019/09/python-2-end-of-life-approaching/

@grzegorznowak
Copy link

Yeah just had the same issue @gowthamakanthan .

The problem is lack of the package on a remote machine not your host. This should fix it assuming package/pip versions match your environment:

- name: Install pip for more dependencies down the line
  apt:
    pkg:
      - python3-pip
      - python-setuptools
    state: present
    update-cache: yes
    install_recommends: no
    cache_valid_time: 3600

- name: Install pips for vault module
  pip:
    name:
      - hvac==0.10.8
    executable: pip3

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

4 participants