I got "ModuleNotFoundError: No module named'azure'" when running a program using Azure SDK for Python

Article content

As the title says, when I tried to run the Python SDK of Azure, the following message appeared and I was addicted to it, so make a note of the corresponding content

ModuleNotFoundError: No module named 'azure'

reference

Conducted up to the construction of the virtual environment of the tutorial Starting cloud development using Azure library for Python

Then run this program Operating Azure from Python with Azure Management Library

code

It is still a reference site, but for the time being

from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
import Config

# (1) Access information
SUBSCRIPTION_ID = Config.SUBSCRIPTION_ID
TENANT_ID = Config.TENANT_ID
CLIENT_ID = Config.CLIENT_ID
CLIENT_SECRET= Config.CLIENT_SECRET

def main():
 # (2) Obtaining credentials
    creds = ServicePrincipalCredentials(
        client_id = CLIENT_ID,
        secret = CLIENT_SECRET,
        tenant = TENANT_ID)

 # (3) Get the object that operates the resource group by specifying the subscription ID
    client = ResourceManagementClient(creds, SUBSCRIPTION_ID)

 # (4) Get the resource group list
    for rg in client.resource_groups.list():
        print("{} {}".format(rg.name, rg.location))

if __name__ == '__main__':
    main()

Correspondence

  1. Reinstall azure (pip uninstall azure → pip install azure)
  2. Move mytestenv to another directory
  3. Run the program
  4. Return mytestenv to the original directory

I'm not convinced, but now it works. *Execution result

fabric2 eastus
MC_fabric2_sample-HLF-AKS_eastus eastus
NetworkWatcherRG japaneast
MC_fabric_sample-HLF-AKS_westus westus
baasTest japanwest
baasTest2 japanwest
blockchain japanwest
fabric japanwest
fabric3 japanwest
cloud-shell-storage-southeastasia southeastasia

Recommended Posts

I got "ModuleNotFoundError: No module named'azure'" when running a program using Azure SDK for Python
ModuleNotFoundError: No module named'***' when running Flask
Let's make a module for Python using SWIG
[Python] I tried running a local server using flask
A story that was convenient when I tried using the python ip address module
I got a Value Error when using JUMAN ++ with PyKNP
[Python] ModuleNotFoundError: No module named'urlparse'
Try a similar search for Image Search using the Python SDK [Search]
[GCP] A memorandum when running a Python program on Cloud Functions
I got a TypeError:'int' object is not iterable when using keras
I tried using the python module Kwant for quantum transport calculation
I get a can't set attribute when using @property in python
A note on using tab completion when running Python interactively on Windows
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
I made a Line-bot using Python!
Python error: ModuleNotFoundError: No module named'flask'
When writing a program in Python
A memo when setting up a Docker container for using JUMAN ++, KNP, python
I get a Python No module named'encodings' error with the aws command
A reminder of what I got stuck when starting Atcoder with python
A useful note when using Python for the first time in a while
Today's python error: ModuleNotFoundError: No module named
What I got into when using Tensorflow-gpu
I made a payroll program in Python!
Today's python error: ModuleNotFoundError: No module named
[python, multiprocessing] Behavior for exceptions when using multiprocessing
Using Azure ML Python SDK 5: Pipeline Basics
Today's python error: ModuleNotFoundError: No module named'requests'
ModuleNotFoundError in Python: No module named story
A program that plays rock-paper-scissors using Python
Today's python error: ModuleNotFoundError: No module named'bs4'
A note I was addicted to when running Python with Visual Studio Code
Linux Ubuntu16.04 I got a little scary error when I ran a command using sudo
Error when installing a module with Python pip
I made a python dictionary file for Neocomplete
vprof --I tried using the profiler for Python
Upgrade the Azure Machine Learning SDK for Python
ModuleNotFoundError: No module named'_bz2' error in pyenv Python
Get note information using Evernote SDK for Python 3
Character encoding when using csv module of python 2.7.3
I get a UnicodeDecodeError when running with mod_wsgi
I tried reading a CSV file using Python
I tried using the Datetime module by Python
I tried adding a Python3 module in C
Trap trapped when running a Python Windows executable
Import cv2 ModuleNotFoundError: No module named'cv2' in python3
I tried running alembic, a Python migration tool
I made a Caesar cryptographic program in Python.
[Python] I want to use only index when looping a list with a for statement
I got stuck when trying to specify a relative path with relative_to () in python
There is a pattern that the program did not stop when using Python threading