# installing ansible-galaxy

**URL:** <https://forum.ansible.com/t/installing-ansible-galaxy/38066>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [June 6, 2023, 1:46pm UTC](https://forum.ansible.com/t/installing-ansible-galaxy/38066 "2023-06-06T13:46:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Azadeh\_Amirhosseini](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@Azadeh\_Amirhosseini](https://forum.ansible.com/u/Azadeh_Amirhosseini)\
**Post date:** [June 6, 2023, 1:46pm UTC](https://forum.ansible.com/t/installing-ansible-galaxy/38066/1 "2023-06-06T13:46:08Z")

</div>

Hi All,  
I have an ansible control node, which is the version 2.10.17  
i need to install fortigate collection by the command:  
ansible-galaxy collection install fortinet.fortios

but i receive the error message (regardless what comes after ansible-galaxy, i kepp on getting the same error message)  
ERROR! Unexpected Exception, this is probably a bug: cannot import name ‘CollectionRequirement’

the full traceback was:

Traceback (most recent call last):  
File “/usr/local/bin/ansible-galaxy”, line 92, in   
mycli = getattr( **import** (“ansible.cli.%s” % sub, fromlist=[myclass]), myclass)  
File “/usr/local/lib/python3.6/site-packages/ansible/cli/galaxy.py”, line 24, in   
from ansible.galaxy.collection import (  
ImportError: cannot import name ‘CollectionRequirement’  
is there any idea how to overcome it?

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [June 6, 2023, 6:15pm UTC](https://forum.ansible.com/t/installing-ansible-galaxy/38066/2 "2023-06-06T18:15:29Z")

</div>

> Hi All,  
> I have an ansible control node, which is the version 2.10.17

Delete or replace that software, and update to a contemporary release  
of ansible-core. There were big structural changes when ansible was  
renamed ansible-core, and the enormous bundle of ansible collection  
modules was renamed ansible. And yes, it's confusing, but that's what  
happened. You now need "ansible-core".

---

<div class="post-metadata">

**Author:** ![Azadeh\_Amirhosseini](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@Azadeh\_Amirhosseini](https://forum.ansible.com/u/Azadeh_Amirhosseini)\
**Post date:** [June 12, 2023, 8:24am UTC](https://forum.ansible.com/t/installing-ansible-galaxy/38066/3 "2023-06-12T08:24:26Z")

</div>

Thanks for your reply.  
I did upgrade the ansible by:  
sudo pip3 install ansible-core==2.15  
and now the ansible-core is updated:  
$ ansible --version  
ansible [core 2.15.0]  
config file = /home/ansible/.ansible.cfg  
configured module search path = [‘/home/ansible/library’]  
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible  
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections  
executable location = /usr/local/bin/ansible  
python version = 3.9.10 (main, Sep 23 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] (/usr/bin/python3)  
jinja version = 3.1.2  
libyaml = True

after running the command:

ansible-galaxy collection install fortinet.fortios

i get the error message:  
ERROR! Unknown error when attempting to call Galaxy at ‘[https://galaxy.ansible.com/api/](https://galaxy.ansible.com/api/)’: \<urlopen error [Errno -2] Name or service not known\>. \<urlopen error [Errno -2] Name or service not known\>

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [June 12, 2023, 8:38am UTC](https://forum.ansible.com/t/installing-ansible-galaxy/38066/4 "2023-06-12T08:38:05Z")

</div>

Sounds like a local dns resolution issue
