-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to import the required Python library (ansible[azure] (azure >= 2.0.0) #1463
Comments
@thisguyshouldworkforus I created an issue for what we are seeing. |
@ericcames After you installed aze.azcollection, did you install the related dependency files? Reinstall all dependent files and try again. Thank you! |
@Fred-sun thank you for the feedback. When I read the dependencies section of the documentation is says there are none. I am installing the collections via the collections directory and a requirements file. Not sure if you are redhat employee or not if you are you can find me via eric.ames@redhat.com. I am working with a customer to prove out that this collection works in their environment. We are looking for ideas on how to get this collection working. Thanks for your feedback! |
I think the console is not loading dependencies correctly. You can see the python dependencies in the repo for the collection: https://github.com/ansible-collections/azure/blob/dev/requirements-azure.txt Since you're using AAP, you should have access to the supported EE that includes these dependencies, IIRC |
Tried the requirements-azure.txt with python3.6 and 3.7 both report "msgraph-sdk==1.0.0 not found". |
@alexander-aps tagging |
@skertz This error is strange because we did not ask to install 'azure-storage'. Could you please provide your detailed execution environment and error information? Thank you! |
@ericcames Can you provide 'pip3 freeze' information and python version information? Thank you! |
@Fred-sun are you wanting this from the container or the controller?? This is the container we are using registry.redhat.io/ansible-automation-platform-23/ee-29-rhel8:latest |
@Fred-sun we created quay.io/zigfreed/ee-azure:latest and have validated that it works as expected with three other asure collections. ---
|
This one does not work: ---
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: error: MainError(additional_data={}, code='BadRequest', details=None, inner_error=InnerError(additional_data={'date': DateTime(2024, 2, 27, 12, 7, 25, tzinfo=Timezone('UTC'))}, client_request_id='24c090c3-8b51-4d10-bba2-d93ba2af6560', date=None, odata_type=None, request_id='f5d97fd3-a0cd-4f9e-8e69-02c50dd1c1b5'), message='/me request is only valid with delegated authentication flow.', target=None) |
Redhat 8 ansible [core 2.15.3] Install:
(python3 is 3.6)
SUCCEEDS, but then: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'azure.storage.cloudstorageaccount' Isn't azure-mgmt-storage and azure-storage-blob defined in the requirements? |
@skertz There are definitions, all of our requirements files are in ~/ requirements-aze.txt. Thank you!
|
@Fred-sun we built these into the execution environment we are using for testing. quay.io/zigfreed/ee-azure:latest |
I'm getting this exact error trying to use I have installed using pipx install --include-deps ansible
pipx runpip ansible install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt My ansible configuration: ❯ ansible --version
ansible [core 2.16.4]
config file = /home/dwales/.ansible.cfg
configured module search path = ['/home/dwales/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/dwales/.local/pipx/venvs/ansible/lib/python3.10/site-packages/ansible
ansible collection location = /home/dwales/.ansible/collections:/usr/share/ansible/collections
executable location = /home/dwales/.local/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/home/dwales/.local/pipx/venvs/ansible/bin/python)
jinja version = 3.1.3
libyaml = True Error message:
I think the problem is that it's trying to import |
@ericcames Sorry, there is an issue that has not been clarified, graphrbac migrated to msgraph, supported python version >=3.8. Please use aze.azcollection >=2.0.0 to run only in an environment higher than python3.8. Thank you! |
@Fred-sun Thank you! |
@ericcames Are you trying the new version? Has the problem been solved? |
I got the same issue and after many try/error, I succeed after manually install python3, ansible on the target computer. Then, I also installed the azure collection and run pip3 install .../requirements/txt all manipulations had been done with root |
@nimbusparis What does your error message look like? Can you provide a detailed log? Thank you! |
Well, now, I don't have the issue anymore, I can try to uninstall the collection and python module, but I hope it wouldn't break anything! 😆 |
Here the vvvv log, hops it could help.
|
@nimbusparis Can you provide your test script? I'd like to try, thank you very much! |
Inventory:
group_vars/ovh.yaml
Playbook:
|
I've run into similar issues to what you're reporting above. Were you ever able to solve this? I did find out that:
I've tried to install the packages (above) that I need, but it doesn't solve the problem. Any tips or recollections you have would be greatly appreciated. |
Yes, this ultimately turned out to be an issue building the Execution
Environment. When I switched to "Ansible-Builder >= 3.0.0" my issues went
away.
I don't know exactly what was wrong, but after rebuilding in v3+, I never
got the error again.
…---
Thanks,
Alexander
Sent from my Google Pixel 7 Pro
On Thu, Jan 2, 2025, 12:28 Martin Lanner ***@***.***> wrote:
@nimbusparis <https://github.com/nimbusparis>,
I've run into similar issues to what you're reporting above. Were you ever
able to solve this? I did find out that:
Starting with v5.0.0, the 'azure' meta-package is deprecated and cannot be installed anymore.
Please install the service specific packages prefixed by `azure` needed for your application.
The complete list of available packages can be found at:
https://aka.ms/azsdk/python/all
Here's a non-exhaustive list of common packages:
- azure-mgmt-compute (https://pypi.python.org/pypi/azure-mgmt-compute) : Management of Virtual Machines, etc.
- azure-mgmt-storage (https://pypi.python.org/pypi/azure-mgmt-storage) : Management of storage accounts.
- azure-mgmt-resource (https://pypi.python.org/pypi/azure-mgmt-resource) : Generic package about Azure Resource Management (ARM)
- azure-keyvault-secrets (https://pypi.python.org/pypi/azure-keyvault-secrets) : Access to secrets in Key Vault
- azure-storage-blob (https://pypi.python.org/pypi/azure-storage-blob) : Access to blobs in storage accounts
I've tried to install the packages (above) that I need, but it doesn't
solve the problem.
Any tips or recollections you have would be greatly appreciated.
—
Reply to this email directly, view it on GitHub
<#1463 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZWZQI5ZA2MFX3U6RHEK632IWHMHAVCNFSM6AAAAABUQPR3KGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRYGI3DMMRTGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
not tried again since my last message |
@nimbusparis Thx. @thisguyshouldworkforus I'm new to the idea of "execution environment" (EE). It was just brought up as an option to me a few days ago. In the past I've always just built my control server using the Ubuntu packages (from PPA). More recently (for reasons) I built it using Rocky Linux 9, until I realized it was hopelessly behind in versions. Over the holidays I switched my Ansible installation back to Ubuntu (again), thinking it would just get me a working system. Ultimately I ended up installing using pip and/or pip through UV because the Ansible from PPA had what appeared as a bunch of of issues with the Azure collection. Still, even with the pivot to pip, the issues remain. However, most basic things seem to work, but I do need to get the Azure thing solved for. Perhaps I really just need to build an EE based on my own container and control and test it all that way. That said, this has turned into a much bigger project than I expected. My experience with Ansible over the years has generally been that it just worked. Now, merely installing it, getting it working and using various collections successfully seems a lot more complex and a bit hit or miss. :( |
To clarify my previous statements, I'm using the "Ansible Automation
Platform (AAP)" for all my Ansible interactions, and EEs are the standard
there.
I cannot speak authoritatively about implementations outside AAP.
…---
Thanks,
Alexander
Sent from my Google Pixel 7 Pro
On Thu, Jan 2, 2025, 14:18 Martin Lanner ***@***.***> wrote:
@nimbusparis <https://github.com/nimbusparis> Thx.
@thisguyshouldworkforus <https://github.com/thisguyshouldworkforus> I'm
new to the idea of "execution environment" (EE). It was just brought up as
an option to me a few days ago. In the past I've always just built my
control server using the Ubuntu packages (from PPA). More recently (for
reasons) I built it using Rocky Linux 9, until I realized it was hopelessly
behind in versions.
Over the holidays I switched my Ansible installation back to Ubuntu
(again), thinking it would just get me a working system. Ultimately I ended
up installing using pip and/or pip through UV because the Ansible from PPA
had what appeared as a bunch of of issues with the Azure collection. Still,
even with the pivot to pip, the issues remain. However, most basic things
seem to work, but I do need to get the Azure thing solved for.
Perhaps I really just need to build an EE based on my own container and
control and test it all that way. That said, this has turned into a much
bigger project than I expected. My experience with Ansible over the years
has generally been that it just worked. Now, merely installing it, getting
it working and using various collections successfully seems a lot more
complex and a bit hit or miss. :(
—
Reply to this email directly, view it on GitHub
<#1463 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZWZQMDS723KQJX7I4CJ4L2IWUK3AVCNFSM6AAAAABUQPR3KGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRYGM4TAMJYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ah, gotcha @thisguyshouldworkforus. Another rabbit hole for me to go down ... 🤣 But first, I think I'll try to make it all work in a container. Thx! |
I am stuck with the same issue as above here.
Error:
|
@soupyframe I did do a few things to work around this problem. Ultimately I don't recall what actually fixed it, but I know for sure that I created a few entries in an
... where the That said, in my case I had a bunch of other dependency issues, which were generally caused by my original Ansible installation running on a RHEL 9 derivative, which had old Ansible, combined with issues around target machines that were running RHEL 8 derivatives. I then switched my Ansible installation to Ubuntu, which fixed a bunch of legacy and EOL issues, including things around the Azure collection, but then caused even more issues due to incompatible/EOL Python versions. Yeah, it's a mess. I started down the path of containerizing Ansible, generally working towards the Execution Environment (EE) path mentioned above. I think that's probably the right direction to go, but it also adds several layers of complexity and additional knowledge, understanding and infra you need to create to make it work. I'm not 100% there yet myself. Surely, doing it the EE way allows you to be very explicit and have controllable environments. But, it's also a lot of work to a) wrap your head around all of that new stuff, b) get that all stood up and working, and c) maintain whatever environments you might need to create for your use-case. Well, anyways ... |
Thank you for providing some insight.
Trying a new install to see if i can get around the issue. I used to use an EE, but since stopped as it was adding unnecessary overhead. |
SUMMARY
Trying to use this module azure.azcollection.azure_rm_account_info with ansible automation platform 2.3 and we are getting the failure list in the title
ISSUE TYPE
COMPONENT NAME
azure.azcollection.azure_rm_account_info
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
azure subscription account
AAP 2.3 on RHEL 8
STEPS TO REPRODUCE
Set up a Microsoft Azure Resource Manager credential in AAP
Create a template to run the playbook listed below
Use this execution environment: quay.io/seanlee/ee-azure:1.12.0
EXPECTED RESULTS
I expect the playbook to pull back the account info.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: