ImportError: No module named runner (environment issues)

How I got here:
I have been wanting to prepare for the upgrade to v2.0 for awhile now and, having just seen the alpha release, I thought I’d try it… super bad idea, it turns out. My whole environment is messed up. I had already apt-gotten it, but after this, I apt-removed it, deleted all leftover files, then reinstalled it.

My Current State:

I reinstalled everything, unfortunately, my environment is still messed. I’m experiencing the following:

$ ansible --version

Traceback (most recent call last):

File “/usr/bin/ansible”, line 36, in

from ansible.runner import Runner

ImportError: No module named runner

$ env | grep -i ansible

$

What I need to know: What commands/actions do I need to do to get my environment in a sane state again? I can tell you that my modules, etc, are in /usr/share/pyshared/ansible… should that be my ANSIBLE_LIBRARY? Any help would be greatly appreciated!

Some info:

Fixed it! Not sure exactly how this fixed it:

sudo rm -rf /usr/local/lib/python2.7/dist-packages/ansible-2.0.0-py2.7.egg

But that did the trick!

thanks Dan

This worked for me too

`
[root@myhost site-packages]# python -V
Python 2.6.6
[root@myhost site-packages]# lsb_release
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
[root@myhost site-packages]# /usr/bin/ansible --version
Traceback (most recent call last):
File “/usr/bin/ansible”, line 36, in
from ansible.runner import Runner
ImportError: No module named runner

[root@myhost site-packages]# pwd
/usr/lib/python2.6/site-packages
[root@myhost site-packages]# ls -lrth | grep ansible
drwxr-xr-x. 4 root root 4.0K Sep 16 17:09 ansible**-2.0.0-py2.6.egg**
drwxr-xr-x. 2 root root 4.0K Sep 17 17:58 ansible-1.9.2-py2.6.egg-info
drwxr-xr-x. 10 root root 4.0K Sep 17 17:58 ansible
[root@myhost site-packages]# rm -rf ansible-2.0.0-py2.6.egg
[root@myhost site-packages]# /usr/bin/ansible --version
ansible 1.9.2
configured module search path = None
`

same here! in my case I tested on Mac OSX El Capitan. summary: I had ansible 2.0.0.2 installed, I installed ansible==1.9.2 and 2.0.0.2 was automatically uninstalled. now it is working fine.

details:

Eduardo-mac:site-packages eduardocerqueira$ sudo pip install ansible==1.9.2
Password:
The directory ‘/Users/eduardocerqueira/Library/Caches/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 ‘/Users/eduardocerqueira/Library/Caches/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.
Collecting ansible==1.9.2
Requirement already satisfied (use --upgrade to upgrade): paramiko in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from ansible==1.9.2)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from ansible==1.9.2)
Requirement already satisfied (use --upgrade to upgrade): PyYAML in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from ansible==1.9.2)
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.6 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from ansible==1.9.2)
Requirement already satisfied (use --upgrade to upgrade): jinja2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from ansible==1.9.2)
Requirement already satisfied (use --upgrade to upgrade): ecdsa>=0.11 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from paramiko->ansible==1.9.2)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from jinja2->ansible==1.9.2)
Installing collected packages: ansible
Found existing installation: ansible 2.0.0.2
Uninstalling ansible-2.0.0.2:
Successfully uninstalled ansible-2.0.0.2
Successfully installed ansible-1.9.2
Eduardo-mac:site-packages eduardocerqueira$ ls -laht |grep ansible
drwxr-xr-x 22 root admin 748B Jan 29 12:21 ansible
drwxr-xr-x 9 root admin 306B Jan 29 12:21 ansible-1.9.2.dist-info
Eduardo-mac:site-packages eduardocerqueira$ ansible --version
ansible 1.9.2
configured module search path = None

@ayekaymail

This worked for me

Do
pip install ansible.runner
Why delete anything when it can be done by installing something :wink: