In my notebook, when trying to create the MLHandler for my workspace in Jupyter, in the first line (from azure.ai.ml import MLClient ) I obtain the following error ModuleNotFoundError: No module named 'azure.ai'

Oscar 30 Reputation points
2023-08-23T18:10:21.6433333+00:00

Hi, I'm trying to follow the first steps tutorial and I've already installed the azure-ai-ml and azure-identity, but any time I try to execute the followig code in jupyter

from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential

# authenticate
credential = DefaultAzureCredential()

# Get a handle to the workspace
ml_client = MLClient(
    credential=credential,
    subscrifption_id="xxx",
    resource_group_name="xxx",
    workspace_name="xxx",
)

the result is allways the same in the first line
ModuleNotFoundError: No module named 'azure.ai'

If I do the same using the VS Code, same error but if I open a terminal and a python session, and run the first line I have no error.
Any clue?
Regards
Oscar

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,598 questions
{count} votes

Accepted answer
  1. VasaviLankipalle-MSFT 18,676 Reputation points Moderator
    2023-08-23T21:46:44.1433333+00:00

    Hello @Oscar , Thanks for using Microsoft Q&A Platform.

    As per the error message it looks like azure.ai module is not installed in the environment where you are working on. Could you please check once again by following command?

    pip show azure-ai-ml
    

    If you haven't already installed azure.ai-ml do install with this command:

    %pip install azure-ai-ml
    

    Additionally, may I know the python version you are using? Python 3.7 or later is required.

    I hope this helps.

    Regards,
    Vasavi

    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.