scicore-unibas-ch / ansible-playbook-scicore-courses-cloud

Ansible playbooks to boot resources in the cloud for the sciCORE courses
2 stars 3 forks source link

ansible import error & cookiecutter new version #15

Closed WandrilleD closed 2 years ago

WandrilleD commented 2 years ago

Hello, I have tried to reproduce the procedure described in the README with the latest version of the repo, and I encountered a couple of issues.

minor issue cookiecutter new version bumps python dependency to >=3.7 with python >=3.7 -> dataclasses has been integrated and should not by in the requirements anymore

more important issue with either python 3.6.9 , 3.7.4, or 3.8.8 the command

ansible-galaxy role install -r ansible/requirements.yml -p ansible/roles/

now returns the following error:

ERROR! Unexpected Exception, this is probably a bug: cannot import name 'CollectionRequirement' from 'ansible.galaxy.collection' (/home/wandrille/Documents/trainingProjects/Introduction_to_RNAseq/ansible-playbook-scicore-courses-cloud/venv_cloud/lib/python3.7/site-packages/ansible/galaxy/collection/__init__.py)
the full traceback was:

Traceback (most recent call last):
  File "/home/wandrille/Documents/trainingProjects/Introduction_to_RNAseq/ansible-playbook-scicore-courses-cloud/venv_cloud/bin/ansible-galaxy", line 92, in <module>
    mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
  File "/home/wandrille/Documents/trainingProjects/Introduction_to_RNAseq/ansible-playbook-scicore-courses-cloud/venv_cloud/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' (/home/wandrille/Documents/trainingProjects/Introduction_to_RNAseq/ansible-playbook-scicore-courses-cloud/venv_cloud/lib/python3.7/site-packages/ansible/galaxy/collection/__init__.py)

Note : for the python 3.6 test, I used cookiecutter 1.7.2 ; for python 3.7 and 3.8 I remove dataclasses from the requirements.

Any idea why we get this error and how to solve this ?

WandrilleD commented 2 years ago

looking at the github repo of ansible, I notice that there the file galaxy.py , which throws the error, does not try to import CollectionRequirement

see https://github.com/ansible/ansible/blob/devel/lib/ansible/cli/galaxy.py , line 29 onward

Could it be an ansible version issue?

pescobar commented 2 years ago

Hi @WandrilleD . Sorry for the late reply but I was on holidays.

How urgent is this? I am asking because I came back from holiday today and I have some tasks to finish. I would like to know how urgent it is to prioritize accordingly

WandrilleD commented 2 years ago

Hi @pescobar , I will be needing this for a course I am giving on Sept 1-2, and I would like to be able to run my tests at 1 week before if possible. Does that seems doable to you or should I start looking for alternative?

pescobar commented 2 years ago

That's not a problem. I think I can fix it this week.

pescobar commented 2 years ago

@WandrilleD I have simplified requirements.txt in master branch . It should work now. Can you give it a try?

WandrilleD commented 2 years ago

It seems to be able to install the requirement without any problem now. Thanks!