我试图从我可以访问的配置中获取Workspace,但是它失败并出现以下错误:
import azureml.core
print("SDK version:", azureml.core.VERSION)
from azureml.core.workspace import Workspace
ws = Workspace.from_config()
print(ws.name, ws.resource_group, ws.location, ws.subscription_id, sep='\n')
SDK版本:0.1.80在以下位置找到配置文件: C:\ Users \ gubert \ Repos \ Gimmonix \ HotelMappingAI \ aml_config \ config.json 使用subscription_id = xxxxxxxxxxxxxxxxxxxxxxx的get_workspace错误, resource_group_name = xxxxxxxxxxxx,workspace_name = gmx-ml-mapping 追溯(最近一次通话):文件 “ C:\ Users \ gubert.azureml \ envs \ myenv \ lib \ site-packages \ azureml_project_commands.py”, get_workspaceworkspace_name中的第320行)文件 “ C:\ Users \ gubert.azureml \ envs \ myenv \ lib \ site-packages \ azureml_base_sdk_common \ workspace \ operations \ workspaces_operations.py”, 第78行,加薪 models.ErrorResponseWrapperException(self._deserialize,响应) azureml._base_sdk_common.workspace.models.error_response_wrapper.ErrorResponseWrapperException: 操作返回了无效的状态码“禁止”
在处理上述异常期间,发生了另一个异常:
回溯(最近通话最近):文件 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd_launcher.py”, 主(sys.argv)文件中的第38行 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd_main_.py”, 行265,在主wait = args.wait中)文件 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd_main_.py”, 第256行,在handle_args run_main(addr,name,kind,* extra,** kwargs)中 文件 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd_local.py”, 第52行,在run_main运行程序中(地址,名称,种类=='模块',*额外, ** kwargs)文件“ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd \ runner.py”, 第32行,在运行中set_trace = False)文件 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd_vendored \ pydevd \ pydevd.py”, 第1283行,在运行中返回self._exec(is_module,entry_point_fn, module_name,file,globals,locals)文件 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd_vendored \ pydevd \ pydevd.py”, 第1290行,在_exec pydev_imports.execfile(file,globals,locals)# 执行脚本文件 “ c:\ Users \ gubert.vscode \ extensions \ ms-python.python-2018.10.1 \ pythonFiles \ experimental \ ptvsd \ ptvsd_vendored \ pydevd_pydev_imps_pydev_execfile.py”, 第25行,在execfile exec(compile(contents +“ \ n”,file,'exec'),glob, loc)文件“ c:\ Users \ gubert \ Repos \ Gimmonix \ HotelMappingAI \ test.py”, ws = Workspace.from_config()文件中的第8行 “ C:\ Users \ gubert.azureml \ envs \ myenv \ lib \ site-packages \ azureml \ core \ workspace.py”, 第153行,位于from_config auth = auth中) “ C:\ Users \ gubert.azureml \ envs \ myenv \ lib \ site-packages \ azureml \ core \ workspace.py”, 第86行,在init中auto_rest_workspace = _commands.get_workspace(auth, subscription_id,resource_group,workspace_name)文件 “ C:\ Users \ gubert.azureml \ envs \ myenv \ lib \ site-packages \ azureml_project_commands.py”, 第326行,在get_workspace resource_error_handling(response_exception, WORKSPACE)文件 “ C:\ Users \ gubert.azureml \ envs \ myenv \ lib \ site-packages \ azureml_base_sdk_common \ common.py”, 第270行,在resource_error_handling引发 ProjectSystemException(response_message) azureml.exceptions._azureml_exception.ProjectSystemException:{ “ error_details”:{“错误”:{“代码”:“ AuthorizationFailed”, “ message”:“具有对象ID的客户端'xxxxxxxxxx@microsoft.com' 'xxxxxxxxxxxxx'无权执行操作 范围内的“ Microsoft.MachineLearningServices /工作区/读取” '/ subscriptions / xxxxxxxxxxxxxx / resourceGroups / CarsolizeCloud-测试 Global / providers / Microsoft.MachineLearningServices / workspaces / gmx-ml-mapping'。” },“ status_code”:403,“ url”: “ https://management.azure.com/subscriptions/xxxxxxxxxxxxx/resourceGroups/CarsolizeCloud%20-%20Test%20Global/providers/Microsoft.MachineLearningServices/workspaces/gmx-ml-mapping?api-version=2018-03-01-preview” }
答案 0 :(得分:0)
请尝试使用最新的SDK版本1.0.10,这是您使用的相当旧的预览版本。如果您仍有问题,请在使用此SDK时告诉我。