Parent module '<module name>' not found while handling absolute import

Git pulled today and got

$ ansible --version
ansible 2.0.0 (devel aee6de5a76) last updated 2015/10/15 12:05:53 (GMT -500)
lib/ansible/modules/core: (detached HEAD 84b1a1a2b7) last updated 2015/10/14 12:09:49 (GMT -500)
lib/ansible/modules/extras: (detached HEAD 8ce3104bc5) last updated 2015/10/14 12:09:50 (GMT -500)
config file = /Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
configured module search path = None

and now I’m getting the following errors

/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks.git/callback_plugins/fix-ssl.py:1: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks’ not found while handling absolute import
import ssl
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/context_demo.py:18: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:18: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:19: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import urllib
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:22: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import prettytable
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:27: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/hipchat.py:28: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.module_utils.urls import open_url
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:18: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:19: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import time
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:20: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import json
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:22: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.utils.unicode import to_bytes
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/log_plays.py:23: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:19: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:20: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import smtplib
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:21: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import json
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:23: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.utils.unicode import to_bytes
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/mail.py:24: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/osx_say.py:19: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import subprocess
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/osx_say.py:20: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/osx_say.py:22: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/profile_tasks.py:21: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import time
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/profile_tasks.py:23: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:1: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:2: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import json
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:4: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import logging
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:5: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import logging.handlers
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:7: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import socket
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/syslog_json.py:9: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:1: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import os
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:2: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
import datetime
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:3: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from datetime import datetime, timedelta
/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/timer.py:5: RuntimeWarning: Parent module ‘/Volumes/Warrior1TB/Users/tanner/projects/ansible’ not found while handling absolute import
from ansible.plugins.callback import CallbackBase

I"m posting here and not in Github’s issue tracker because what also changed (yesterday) is I upgraded to OS X El Capitan (10.11) so I don’t know if the issue is in my OS upgrade or today’s git pull.

Using git bisect here’s what I find.

$ git bisect good
d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447 is the first bad commit
commit d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447

$ git bisect log
git bisect start

bad: [aee6de5a7696520f1fea00a145af055732d8e570] group_names should not include implied ‘all’, fixes #12763

git bisect bad aee6de5a7696520f1fea00a145af055732d8e570

good: [cb9f350c8fa74225c3e4e23e720fbbd7e5792548] Merge pull request #12720 from jhawkesworth/test_amc_2147

git bisect good cb9f350c8fa74225c3e4e23e720fbbd7e5792548

bad: [0526b43b5fd61d2894026960e433b0cc9b72a692] Merge pull request #12757 from mgedmin/py3k

git bisect bad 0526b43b5fd61d2894026960e433b0cc9b72a692

bad: [ab569cea2253fd70bc8b3f0a2540ac0d075e8c4a] Move to_str alias into ansible.utils.unicode

git bisect bad ab569cea2253fd70bc8b3f0a2540ac0d075e8c4a

bad: [85abd61001ffa59f92db56080f04fa4287460fe0] Add some more info to docstring

git bisect bad 85abd61001ffa59f92db56080f04fa4287460fe0

bad: [d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447] Reworking the way all() works in plugin_loader

git bisect bad d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447

good: [45b803efb44b7cf744ccc365f52f3adbfafed0a0] Properly use test_loader from SharedPluginLoaderObj

git bisect good 45b803efb44b7cf744ccc365f52f3adbfafed0a0

first bad commit: [d923d05a33431e9c4c9d3d03bdb4bbdfd4b90447] Reworking the way all() works in plugin_loader

So I think the issue is in Ansible and not my upgrade to OS X 10.11?

I’ve seen this on a few Linux boxes, so it’s definitely not related to OSX. I’ve only seen it when I try to install from source though. My solution was to completely uninstall ansible, and re-install. This seems to stem from some weird older version still being in /usr/lib. I ended up basically just doing a find on /usr and removing any Ansible bits I found.

I opened an issue https://github.com/ansible/ansible/issues/12786, closed with https://github.com/ansible/ansible/commit/1ab0e0e228a82c20b092913ce5c8b9b0e2f67f4e