# Running from Source - callbacks error

**URL:** <https://forum.ansible.com/t/running-from-source-callbacks-error/18692>\
**Category:** Ansible Project\
**Tags:** ubuntu, galaxy-ng\
**Created:** [July 6, 2015, 7:39pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692 "2015-07-06T19:39:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethan\_Merrill](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Ethan\_Merrill](https://forum.ansible.com/u/Ethan_Merrill)\
**Post date:** [July 6, 2015, 7:39pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/1 "2015-07-06T19:39:57Z")

</div>

Hi…

I just setup a new ubuntu system to run from source using the “sudo make install” command. When I try to run scripts that use “from ansible import callbacks” Python gives an error that callbacks doesn’t exist. If I just try running the following from the command line I get the same:

vagrant@precise64:~/ansible$ python  
Python 2.7.3 (default, Jun 22 2015, 19:33:41)  
[GCC 4.6.3] on linux2  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > from ansible import callbacks  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > ImportError: cannot import name callbacks

However importing other things like ansible utils does work.

I notice that there are no longer any callback py or pyc files in /usr/local/lib/python2.7/dist-packages/ansible-2.0.0-py2.7.egg/ansible/:

vagrant@precise64:/usr/local/lib/python2.7/dist-packages/ansible-2.0.0-py2.7.egg/ansible$ ll  
total 112  
drwxr-sr-x 18 root staff 4096 Jul 6 19:32 ./  
drwxr-sr-x 4 root staff 4096 Jul 6 19:32 …/  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 cli/  
drwxr-sr-x 3 root staff 4096 Jul 6 19:32 compat/  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 config/  
-rwxr-xr-x 1 root staff 15580 Jul 6 19:32 constants.py\*  
-rw-r–r-- 1 root staff 13616 Jul 6 19:32 constants.pyc  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 errors/  
drwxr-sr-x 3 root staff 4096 Jul 6 19:32 executor/  
drwxr-sr-x 3 root staff 4096 Jul 6 19:32 galaxy/  
-rwxr-xr-x 1 root staff 765 Jul 6 19:32 **init**.py\*  
-rw-r–r-- 1 root staff 242 Jul 6 19:32 **init**.pyc  
drwxr-sr-x 3 root staff 4096 Jul 6 19:32 inventory/  
drwxr-sr-x 4 root staff 4096 Jul 6 19:32 modules/  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 module\_utils/  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 new\_inventory/  
drwxr-sr-x 5 root staff 4096 Jul 6 19:32 parsing/  
drwxr-sr-x 3 root staff 4096 Jul 6 19:32 playbook/  
drwxr-sr-x 12 root staff 4096 Jul 6 19:32 plugins/  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 template/  
drwxr-sr-x 3 root staff 4096 Jul 6 19:32 utils/  
drwxr-sr-x 2 root staff 4096 Jul 6 19:32 vars/  
vagrant@precise64:/usr/local/lib/python2.7/dist-packages/ansible-2.0.0-py2.7.egg/ansible$

Are callbacks being referenced differently now?

Ethan

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 6, 2015, 8:16pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/2 "2015-07-06T20:16:18Z")

</div>

they should be under plugins/callbacks

---

<div class="post-metadata">

**Author:** ![Ethan\_Merrill](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Ethan\_Merrill](https://forum.ansible.com/u/Ethan_Merrill)\
**Post date:** [July 6, 2015, 8:25pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/3 "2015-07-06T20:25:29Z")

</div>

I see plugins/callback (notice it’s singular) and the contents don’t appear to be the same as the callbacks py/pyc files from earlier.

Ethan

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 6, 2015, 8:28pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/4 "2015-07-06T20:28:38Z")

</div>

we have not finished porting allt he callbacks, the API has changed a  
bit, but the default ones used by ansible and ansible-playbook should  
be there

---

<div class="post-metadata">

**Author:** ![Ethan\_Merrill](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Ethan\_Merrill](https://forum.ansible.com/u/Ethan_Merrill)\
**Post date:** [July 7, 2015, 1:56pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/5 "2015-07-07T13:56:21Z")

</div>

Ok, can you please try this simple test and let me know if you see the same?

Start with new ubuntu machine

$ git clone git://github.com/ansible/ansible.git --recursive  
$ cd ./ansible  
$ sudo make install

$ python

> > > from ansible import callbacks  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > ImportError: cannot import name callbacks

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 7, 2015, 2:01pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/6 "2015-07-07T14:01:38Z")

</div>

"from ansible import callbacks" is not valid in v2

---

<div class="post-metadata">

**Author:** ![Ethan\_Merrill](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Ethan\_Merrill](https://forum.ansible.com/u/Ethan_Merrill)\
**Post date:** [July 7, 2015, 6:59pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/7 "2015-07-07T18:59:06Z")

</div>

Is there doc on how to do this in v2? The equivalent of:

```auto
from ansible import callbacks
from ansible import utils

stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 7, 2015, 7:49pm UTC](https://forum.ansible.com/t/running-from-source-callbacks-error/18692/8 "2015-07-07T19:49:46Z")

</div>

no, we really never have had API docs, the changes in v2 are  
substantial and you'll probably need to rewrite all that, for example  
runner does not exist anymore.
