[root@jenkins-dev playbooks]# ansible-galaxy collection install azure.azcollection
ERROR! Unexpected Exception, this is probably a bug: cannot import name 'CollectionRequirement' from 'ansible.galaxy.collection' (/usr/local/lib/python3.7/site-packages/ansible/galaxy/collection/__init__.py)
the full traceback was:
Traceback (most recent call last):
File "/usr/local/bin/ansible-galaxy", line 92, in <module>
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
File "/usr/local/lib/python3.7/site-packages/ansible/cli/galaxy.py", line 24, in <module>
from ansible.galaxy.collection import (
ImportError: cannot import name 'CollectionRequirement' from 'ansible.galaxy.collection' (/usr/local/lib/python3.7/site-packages/ansible/galaxy/collection/__init__.py)
Asked
Active
Viewed 1,639 times
0

β.εηοιτ.βε
- 33,893
- 13
- 69
- 83
1 Answers
5
This exception indicates you have overlapping conflicting installations of ansible-core
(or ansible-base
) and ansible<2.10.
You will need to clean up your installs to resolve the issue. Potentially via:
$ sudo pip uninstall -y ansible-base ansible-core
And then install again:
$ sudo pip install ansible-base ansible-core

Jeremy Caney
- 7,102
- 69
- 48
- 77

Tim
- 61
- 4
-
Thanks! I had it installed both via pip and dnf, removing it on pip that did the trick. – Entimon Jun 14 '22 at 12:47