# Error on the "Install the Ansible Galaxy roles" step of Trellis installation (Newbie)

**URL:** https://discourse.roots.io/t/error-on-the-install-the-ansible-galaxy-roles-step-of-trellis-installation-newbie/6611
**Category:** trellis
**Created:** 2016-04-30T18:23:28Z
**Posts:** 26

## Post 1 by @vpell — 2016-04-30T18:23:28Z

Hi,

I tried to make my first installation of Trellis, Bedrock and Sage following the docs and i have a problem during the Trellis installation during step 4 (“Install the Ansible Galaxy roles”).

The result to the command:  
`$ ansible-galaxy install -r requirements.yml`

is this error message:

> ERROR! Unexpected Exception: ‘ImportError’ object has no attribute ‘message’  
> the full traceback was:

> Traceback (most recent call last):  
> File “/Library/Frameworks/Python.framework/Versions/3.5/bin/ansible-galaxy”, line 73, in   
> mycli = getattr( **import** (“ansible.cli.%s” % sub, fromlist=[myclass]), myclass)  
> File “/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ansible/cli/galaxy.py”, line 37, in   
> from ansible.galaxy.api import GalaxyAPI  
> File “/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ansible/galaxy/api.py”, line 30, in   
> from urllib2 import quote as urlquote, HTTPError  
> ImportError: No module named ‘urllib2’

> During handling of the above exception, another exception occurred:

> Traceback (most recent call last):  
> File “/Library/Frameworks/Python.framework/Versions/3.5/bin/ansible-galaxy”, line 79, in   
> if e.message.endswith(’ %s’ % sub):  
> AttributeError: ‘ImportError’ object has no attribute ‘message’

I have installed ansible 2.0.2.0 and i’m using Os X 10.11.3.

Thanks for your help!

---

## Post 2 by @swalkinshaw — 2016-04-30T18:36:57Z

Ansible only works with Python 2 and from your traceback it looks like 3.5 is being used? Maybe it’s the default on OS X 10.11 now. My guess is that you need to install Python 2.x.

---

## Post 3 by @fredcerdeira — 2016-04-30T18:37:04Z

I got a similar error on OX El Capitain:

_ERROR! Unexpected Exception: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse(‘setuptools\>=11.3’))_  
_the full traceback was:_

_Traceback (most recent call last):_  
\_ File “/usr/local/bin/ansible-galaxy”, line 73, in \_  
\_ mycli = getattr( **import** (“ansible.cli.%s” % sub, fromlist=[myclass]), myclass)\_  
\_ File “/Library/Python/2.7/site-packages/ansible/cli/galaxy.py”, line 38, in \_  
\_ from ansible.galaxy.role import GalaxyRole\_  
\_ File “/Library/Python/2.7/site-packages/ansible/galaxy/role.py”, line 35, in \_  
\_ from ansible.playbook.role.requirement import RoleRequirement\_  
\_ File “/Library/Python/2.7/site-packages/ansible/playbook/ **init**.py”, line 25, in \_  
\_ from ansible.playbook.play import Play\_  
\_ File “/Library/Python/2.7/site-packages/ansible/playbook/play.py”, line 27, in \_  
\_ from ansible.playbook.base import Base\_  
\_ File “/Library/Python/2.7/site-packages/ansible/playbook/base.py”, line 35, in \_  
\_ from ansible.parsing.dataloader import DataLoader\_  
\_ File “/Library/Python/2.7/site-packages/ansible/parsing/dataloader.py”, line 32, in \_  
\_ from ansible.parsing.vault import VaultLib\_  
\_ File “/Library/Python/2.7/site-packages/ansible/parsing/vault/ **init**.py”, line 67, in \_  
\_ from cryptography.hazmat.primitives.hashes import SHA256 as c\_SHA256\_  
\_ File “/Library/Python/2.7/site-packages/cryptography/hazmat/primitives/hashes.py”, line 15, in \_  
\_ from cryptography.hazmat.backends.interfaces import HashBackend\_  
\_ File “/Library/Python/2.7/site-packages/cryptography/hazmat/backends/ **init**.py”, line 7, in \_  
\_ import pkg\_resources\_  
\_ File “/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg\_resources.py”, line 2797, in \_  
\_ parse\_requirements( **requires** ), Environment()\_  
\_ File “/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg\_resources.py”, line 580, in resolve\_  
\_ raise VersionConflict(dist,req) # XXX put more info here\_  
_VersionConflict: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse(‘setuptools\>=11.3’))_

---

## Post 4 by @fredcerdeira — 2016-04-30T18:42:36Z

Hi. in my case I have Python 2.x running, but I got the error that I put bellow, any thoughts?

---

## Post 5 by @swalkinshaw — 2016-04-30T20:01:06Z

Sorry, but I’m not really sure. This is more of a Python issue on your local machine than an Ansible or Trellis issue. You could try re-installing Python through Homebrew.

---

## Post 6 by @DavidSchargel — 2016-04-30T20:51:37Z

As long as you have `python` (not `python3`) installed via homebrew,I would venture a guess that either

1. Homebrew is not at the “top” of your PATH environment variable. Fix this within `~/.profile` or `~/.bash_profile` with the line like: `export PATH=/usr/local/bin:/usr/local/sbin:$PATH`, or
2. pip `setuptools` may be an old version, which can be remedied (and everything else listed & updated) with:  
$ `pip list --outdated`  
$ `pip install --upgrade pip setuptools`  
$ `pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U`

---

## Post 7 by @fredcerdeira — 2016-04-30T21:25:32Z

I didn’t install any Python version, Python is default in my machine:

~ python  
Python 2.7.10 (default, Oct 23 2015, 19:19:21)  
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin

---

## Post 8 by @DavidSchargel — 2016-04-30T22:33:09Z

Well then…get homebrew fully setup and install (at least) `python` & `ansible` installed with `brew install`. Then tell us what happens.

Stay away from `sudo` installs/updates into your system if you can help it. Leave that to Apple.

---

## Post 9 by @fredcerdeira — 2016-04-30T22:52:42Z

It’s now fixed but in a wird way. After a long digg, i finally managed to upgrade the python setuptools with this:

pip install --upgrade setuptools --user python  
([http://stackoverflow.com/questions/33234665/upgrading-setuptools-on-osx-el-capitan](http://stackoverflow.com/questions/33234665/upgrading-setuptools-on-osx-el-capitan))

the wird stuff is that I got the same setuptools version (1.1.6) but now everything works fine with the Ansible Galaxy roles…

thanks for you support!

---

## Post 10 by @vpell — 2016-05-01T05:32:57Z

Thanks everybody for your answers!

I’ll try a few things based on your feedback and get back to you if i solve it… or not :wink:

---

## Post 11 by @Twansparant — 2016-05-02T13:41:25Z

> [@fredcerdeira](#):
>
> pip install --upgrade setuptools --user python

Yes, that fixed it for me. Thanks!

---

## Post 12 by @DavidSchargel — 2016-05-02T18:05:53Z

Congratulations, that’s great news!

I would like to **strongly** suggest to you (and anyone else reading this thread) to get `homebrew` onto any Macintosh you plan on using Trellis with.

Updating OS X system components is a no win, zero sum game. At best, if you are lucky, you will likely need to run these upgrade commands again when a new OS update comes out. At worst, you break system functionality and sometimes are almost forced to do global/`sudo` installs of `ansible`, `npm`, etc.

A few years ago, I did not use `homebrew` and had horrible experiences with OS X updates overwriting multiple ruby packages. I would never wish a forced OS X re-install to anyone working on deadlines

---

## Post 13 by @vpell — 2016-05-05T15:10:00Z

Hi,

based on your feedback, after a long struggle, Google searching, reading online tutoriels and fiddling in the Terminal, i managed somehow to pass successfully that step 4 of the Trellis install!

i resolved my problem by:

- uninstalling Python 3.5 (and Ansible which i had previously installed in it), leaving only the Python version of El Capitan
- installing pyenv via homebrew
- installing Python 2.7.11 and 3.5.1 via pyenv
- setting Python 2.7.11 as global via pyenv
- re-installing Ansible via pip in the Python 2.7.11 managed by pyenv

Once everything correctly installed, it just worked (and i learned a few tricks, still a newbie though).

Next step: configuring the WordPress sites, wish me luck :wink:

---

## Post 14 by @Michael — 2016-05-25T21:06:36Z

I ran into a similar issue on vagrant up, after I upgraded pip. I upgraded setuptools but was unable to upgrade asnisble. Wrote the ansible upgrade command like this and it worked fine.  
`sudo -H pip install --upgrade ansible --user python`

---

## Post 15 by @plarcher — 2016-06-09T18:17:32Z

> [@Twansparant](#):
>
> pip install --upgrade setuptools --user python

It was working for me… until I install Homebrew… Now I’m stuck with this same issue, not sure how to proceed.

---

## Post 16 by @DavidSchargel — 2016-06-09T19:59:35Z

Do you know if the python/pip that you now have is via homebrew? You might want to start with `which pip` to make sure it is within a homebrew directory (/usr/local/bin/) and then follow [the 3 pip list/install/freeze commands from my April 30 post](https://discourse.roots.io/t/error-on-the-install-the-ansible-galaxy-roles-step-of-trellis-installation-newbie/6611/). Separately, you can update all of homebrew with these three commands: `brew update; brew upgrade --all; brew doctor`

---

## Post 17 by @plarcher — 2016-06-10T08:27:12Z

> [@DavidSchargel](#):
>
> make sure it is within a homebrew directory (/usr/local/bin/)

Yes it’s good!

Everything is up to date.

The freeze command brings an error message :slight_smile:

`Exception: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run prefix=options.prefix_path, File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 736, in install requirement.uninstall(auto_confirm=True) File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 742, in uninstall paths_to_remove.remove(auto_confirm) File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/usr/local/lib/python2.7/site-packages/pip/utils/ __init__.py", line 267, in renames shutil.move(old, new) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 300, in move rmtree(src) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 252, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 250, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/ansible-2.0.2.0-py2.7.egg-info/dependency_links.txt' `

---

## Post 18 by @DavidSchargel — 2016-06-10T16:51:18Z

Did you copy/paste the whole last line?  
`pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U`

That last OSError line is a concern as is referencing the OS (and not homebrew) system. I don’t even have a a thought as to a direction to point you in with that one. :confused:

---

## Post 19 by @plarcher — 2016-06-10T16:59:23Z

> [@DavidSchargel](#):
>
> Did you copy/paste the whole last line?

Yes I did :wink:

I did a “doctor” and I have unlinked directories apparently, trying some fixes… Not sure where I’m going ^^°

Currently reading this : [Can't upgrade pip · Issue #3636 · pypa/pip · GitHub](https://github.com/pypa/pip/issues/3636)

---

## Post 20 by @plarcher — 2016-06-10T17:10:40Z

> [@DavidSchargel](#):
>
> pip freeze --local | grep -v ‘^-e’ | cut -d = -f 1 | xargs pip install -U

So the Freeze is still bringing an error message BUT the ansible galaxy role has been installed and vagrant up is working now :slight_smile:

Maybe after a sudo pip upgrade?

---

## Post 21 by @DavidSchargel — 2016-06-10T17:21:30Z

I’m at a loss here. My best guess is that you have a pip-referenced package(s) that is lurking in the system library. I would probably try to

1. Make a system backup :sweat_smile:
2. Uninstall all homebrew-based pip installs
3. Run those “pip freeze” commands to see if the problem is still there
4. Reinstall the basic pip packages:  
`pip install --upgrade pip setuptools pep8 passlib`
5. Run those “pip freeze” commands again and keep fingers crossed.

---

## Post 22 by @plarcher — 2016-06-10T17:30:11Z

Gonna try this ! Thanks a lot.

* * *

Finally my vagrant up has some issues :

> ERROR! Unexpected Exception: ‘TaskInclude’ object has no attribute ‘has\_triggered’  
> Ansible failed to complete successfully. Any error output should be  
> visible above. Please fix these errors and try again.

BTW it was working fine a few weeks ago, except for vault encryption.

* * *

Saturday news : I removed the Pythons in /libraries and the freeze command ran properly.  
Still having the error when doing vagrant up.

---

## Post 23 by @buretta — 2016-06-13T21:40:10Z

Think this issue is a dupe of

> [@'TaskInclude' object has no attribute 'has_triggered'](https://discourse.roots.io/t/taskinclude-object-has-no-attribute-has-triggered/6834/):
>
> Getting this error with latest Trellis and Ansible setting up my local developer box. RUNNING HANDLER [common : reload nginx] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* to see the full traceback, use -vvv ERROR! Unexpected Exception: 'TaskInclude' object has no attribute 'has\_triggered' Ansible failed to complete successfully. Any error output should be visible above. Please fix these errors and try again. Seems to be issue with latest Ansible or at least my version. Here details on my version: …

---

## Post 24 by @plarcher — 2016-06-18T10:01:21Z

It’s now all solved reverting to Ansible 2.0

---

## Post 25 by @swalkinshaw — 2016-06-18T20:26:43Z

This thread is about a specific Python 3 issue which has been solved. I’m closing it so others don’t keep posting about unrelated problems.

---

## Post 26 by @swalkinshaw — 2016-06-18T20:26:46Z


