-
Notifications
You must be signed in to change notification settings - Fork 315
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
ModuleNotFoundError: No module named 'azure' #1415
Comments
Added fact, if I install ansible with pip then it works. But since the Ubuntu22/ansible/ansible collections are a common/standard thing I think it would be good to document this (how to make it work without pip or document you must use pip. |
@KlemenDanfoss You install all the dependent files that are required for pip installation. If your pip installation dependency fails, you will be prompted with the above error! Thanks!
|
@Fred-sun ; I wrote in the instructions that this is a step I execute - still doesn't work. |
@KlemenDanfoss Build the environment according to the steps in the newly built ubuntu22.04. After the environment is completed, it can run normally. Can you check that each of your commands has been executed successfully? Could you please provide your playbook and 'pip3 list' information? Thank you very much! |
@klemen-df However, I built a new virtual machine locally, performed the actions you installed above, and did not encounter any errors when executing the script. Thank you!
|
@klemen-df Can you provide your version of the system and follow the steps above, what is the result? |
Hi, it works with a plain Ubuntu image. It doesn't work with Ubuntu image for Azure Microsoft Hosted agents - link. But there ansible is installed with pipx. |
@klemen-df I'm not sure. Can you speak more clearly? Thank you! |
If you run a pipeline in Azure Devops and you run it on the shared, Microsoft provided runners (the description of the image is in the link above) you run with packages that are preinstalled. On the image Ansible is preinstalled with pipx. So, if you use the preinstalled Ansible and 'just' install 'ansible-galaxy collection install azure.azcollection' it doesnt work (error above) Also, if you remove ansible with pipx and install 'fresh' (commands above, the tutorial ones) it also doesnt work (same error). |
If the reinstallation didn't work, what was this mistake? |
When I run the playbook I get: |
@klemen-df From the error point of view, the installed package is not found, causing such an error to be triggered. These dependencies are not installed, or under different python environments. I occasionally get this error when installing, but reinstalling is fine! Thank you! |
SUMMARY
-- sudo apt update
-- sudo apt install software-properties-common
-- sudo add-apt-repository --yes --update ppa:ansible/ansible
-- sudo apt install ansible
-- ansible-galaxy collection install azure.azcollection
-- pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
When I run the playbook I get:
fatal: [worker1 -> localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on ansiblerunner's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
ISSUE TYPE
COMPONENT NAME
azure.azcollection
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Ubuntu 22.04, latest patches installed
STEPS TO REPRODUCE
Install Ubuntu22 (standard installation), update OS, install ansible by standard instructions and install collection with standard instructions
EXPECTED RESULTS
Module should be fine
ACTUAL RESULTS
Module not found.
The text was updated successfully, but these errors were encountered: