Skip to content
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.profiles' #122237

Open
SongYouk opened this issue May 5, 2024 · 2 comments
Open

ModuleNotFoundError: No module named 'azure.profiles' #122237

SongYouk opened this issue May 5, 2024 · 2 comments

Comments

@SongYouk
Copy link

SongYouk commented May 5, 2024

[Enter feedback here]
Dear azure support team,
could you check again really this page works?

I have installed all the packages' whl files as attached.

image

And I followrf all the process as described, and I remember that about two months ago I could get success from the same page, but today(May 5th, 2024), continuously get the error as "ModuleNotFoundError: No module named 'azure.profiles'"

So could you review and clarify again?

with best regards,


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@TPavanBalaji
Copy link

@SongYouk
Thanks for your feedback! We will investigate and update as appropriate.

@SongYouk
Copy link
Author

SongYouk commented May 6, 2024

@TPavanBalaji
The solution is very simple. I solved now. But I would like to recommend two things to be updated in the page.

  1. Not any more possible to add new pacakges into the environment which azure maintains. The information is given as below in the sublink from the page.
    image

But not any more possible to add new packages from the given environment. So should create new environment by myself as below.
image

  1. In the page 6 packages are listed. But should install "azure-common" as well
    Listed

Should be azure-common installed.
Then now works. To let anyone can refer to this solution, I attached the pacakage information and my script.

image

The below is my script in runbook to start VM. And I used Service Principal rather than using 'azure_credential = DefaultAzureCredential()'

#!/usr/bin/env Python38new
# Example function to uninstall packages before reinstalling
import subprocess
import sys
import os

def upgrade_pip():
    subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])

from azure.identity import ClientSecretCredential
from azure.mgmt.compute import ComputeManagementClient

credential = ClientSecretCredential(
    tenant_id='Your Tenant ID',
    client_id='Your Client ID',
    client_secret='Your Client Secret'
)

compute_client = ComputeManagementClient(credential, 'Your Subscription ID')

# Get resource group and VM name from command-line arguments

resource_group_name = "vm-tws_group"
vm_name = "vm-tws"

# Start the VM
print('\nStarting VM...')
async_vm_start = compute_client.virtual_machines.begin_start(resource_group_name, vm_name)
async_vm_start.wait()
print('\nVM started successfully.')

with best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants