sdkv2 job on local compute fails with registry authentication error

uberj 20 Reputation points
2023-05-25T17:27:12.6633333+00:00

Steps to reproduce:

Run code from: https://learn.microsoft.com/en-us/azure/machine-learning/migrate-to-v2-local-runs?view=azureml-api-2

#import required libraries
from azure.ai.ml import MLClient, command
from azure.ai.ml.entities import Environment
from azure.identity import DefaultAzureCredential

#connect to the workspace
ml_client = MLClient.from_config(DefaultAzureCredential())

# set up pytorch environment
env = Environment(
    image='mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04',
    conda_file='pytorch-env.yml',
    name='pytorch-env'
)

# define the command
command_job = command(
    code='./src',
    command='train.py',
    environment=env,
    compute='local',
)

returned_job = ml_client.jobs.create_or_update(command_job)
returned_job

Expected: Job runs

Actual:

Traceback (most recent call last):
  File "test.py", line 23, in <module>
    returned_job = ml_client.jobs.create_or_update(command_job)
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/ai/ml/_telemetry/activity.py", line 337, in wrapper
    return_value = f(*args, **kwargs)
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/ai/ml/operations/_job_operations.py", line 609, in create_or_update
    raise ex
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/ai/ml/operations/_job_operations.py", line 573, in create_or_update
    snapshot_id = start_run_if_local(
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/ai/ml/operations/_local_job_invoker.py", line 415, in start_run_if_local
    cr_helper.get_bootstrapper_binary(bootstrapper_info)
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/ai/ml/operations/_local_job_invoker.py", line 310, in get_bootstrapper_binary
    docker_client = self.get_docker_client(registry)
  File "/home/uberj/anaconda3/envs/mlopspython_ci/lib/python3.8/site-packages/azure/ai/ml/operations/_local_job_invoker.py", line 232, in get_docker_client
    if registry:
RuntimeError: Login to Docker registry 'mcr.microsoft.com' failed. See error message: 'username'
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,848 questions
{count} votes

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.