2

My environment:

python --version  
Python 3.5.2  

pip --version    
pip 19.3.1 from /home/chinmaya/.local/lib/python3.5/site-packages/pip (python 3.5)

ansible --version
ansible 2.9.2
  config file = None  
  configured module search path = ['/home/chinmaya/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']  
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible  
  executable location = /usr/local/bin/ansible  
  python version = 3.5.2 (default, Oct  8 2019, 13:06:37) [GCC 5.4.0 20160609]  

Installed and upgrade openstacksdk with following code
pip install --user --upgrade openstacksdk
This installed following packages
Successfully installed certifi-2019.11.28 chardet-3.0.4 decorator-4.4.1 dogpile.cache-0.9.0 idna-2.8 jmespath-0.9.4 jsonpatch-1.24 keystoneauth1-3.18.0 munch-2.5.0 openstacksdk-0.39.0 os-service-types-1.7.0 pbr-5.4.4 requests-2.22.0 requestsexceptions-1.4.0 stevedore-1.31.0 urllib3-1.25.7

Now executed a playbook ansible-playbook installNifiCentos.yml
This gave following error:
enter image description here

Now I am getting no clue to solve this issue.

Community
  • 1
  • 1
  • 1
    Make sure that the [interpreter discovery](https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html) is not pointing to an other version of python than the one you installed the library in. If it is the case, you can either set `ansible_python_interpreter` to the correct version or install the lib in the correct python version. – Zeitounator Dec 23 '19 at 16:13
  • 1
    A quick way to check which version of python you are using when connecting to localhost: `ansible localhost -m debug -a "var=ansible_python_interpreter"` – Zeitounator Dec 23 '19 at 17:22
  • with the command ```ansible localhost -m debug -a "var=ansible_python_interpreter"``` I am getting following success message. ```[WARNING]: No inventory was parsed, only implicit localhost is available localhost | SUCCESS => { "ansible_python_interpreter": "/usr/bin/python3" } ``` So I guess ansible python interpreter is configured properly. – CHINMAYA DEHURY Dec 24 '19 at 10:19
  • I would not bet on that. What does `/usr/bin/python3 --version` tells you compared to `python --version` ? They could be different python versions. The fact is that you installed the module in a place where ansible cannot find it when running on the host so you have to find out why and where. – Zeitounator Dec 24 '19 at 10:24
  • One other thing: you installed your lib with the `--user` option. Are you connecting with the same user as you installed with ? – Zeitounator Dec 24 '19 at 10:29
  • Both the command giving me the same output. Here is the screenshot[link](https://www.dropbox.com/s/fi53dc4ht9icj23/error2.bmp?dl=0). I have checked ```/usr/bin/``` directory. ```/usr/bin/python3``` is just a symbolic link to ```/usr/bin/python3.5```. – CHINMAYA DEHURY Dec 24 '19 at 10:33
  • yes @Zeitounator, I am connected to the same user. – CHINMAYA DEHURY Dec 24 '19 at 10:34

2 Answers2

1

I was getting all such conflicts probably due to both python versions. I decided to remove the python 2.7 and keep only one Python 3.5.2. After removing Python 2.7, this started working. Still, I don't know where was the problem.

0

I have removed python 2.7 and done the upgrade. Then installed openstack client using pip3. This worked for me.

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y python3-pip
Sanka Sathyaji
  • 488
  • 5
  • 10