ImportError: No module named runner (environment issues)

5,668 views
Skip to first unread message

Dan Swartz

unread,
Aug 31, 2015, 10:38:48 AM8/31/15
to Ansible Project
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 <module>
    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:
# uname -a
Linux HOSTNAME 3.16.0-40-generic #54~14.04.1-Ubuntu SMP Wed Jun 10 17:30:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
(Kubuntu)

Dan Swartz

unread,
Aug 31, 2015, 10:54:15 AM8/31/15
to ansible...@googlegroups.com
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!

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/mJ6ve0hvhbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e956e6b1-0c0e-4c35-ae2c-dc32665b0d99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ayekaymail

unread,
Sep 17, 2015, 6:11:25 PM9/17/15
to Ansible Project
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 <module>
   
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

Eduardo Cerqueira

unread,
Jan 29, 2016, 12:30:44 PM1/29/16
to Ansible Project
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




Ajinkya Nerkar

unread,
Feb 16, 2018, 4:54:20 AM2/16/18
to Ansible Project


@ayekaymail

This worked for me 
Do
pip install ansible.runner 
Why delete anything when it can be done by installing something ;)  
Reply all
Reply to author
Forward
0 new messages