0

我正在尝试遵循本教程并收到以下错误。我正在使用 python 3 在 jupyter notebook 中工作。我正在尝试使用 Azure 工具和我附加的 Microsoft doc 构建推荐引擎。

TypeError: init () 接受 2 个位置参数,但给出了 3 个

我附上了来自 jupyter notebook 的代码图像,以演示正确的格式

我尝试了使用 Pip 回滚 Azure Python SDK 的解决方案。我运行 pip install --upgrade azureml-sdk 一切看起来都不错。非常感谢您的任何帮助!

代码如下所示:

    print(workspace_name)
    ws = Workspace.create(
        name=workspace_name,
        subscription_id=subscription_id,
        resource_group=resource_group, 
        location=location,
        exist_ok=True
    )

The full error appears below:
'''
   TypeError                                 Traceback (most recent call last)
    <ipython-input-11-25e04e55f419> in <module>
      5     resource_group=resource_group,
      6     location=location,
----> 7     exist_ok=True
      8 )

~\.conda\envs\reco_pyspark\lib\site-packages\azureml\core\workspace.py in create(name, auth, subscription_id, resource_group, location, create_resource_group, sku, friendly_name, storage_account, key_vault, app_insights, container_registry, cmk_keyvault, resource_cmk_uri, hbi_workspace, default_cpu_compute_target, default_gpu_compute_target, private_endpoint_config, private_endpoint_auto_approval, exist_ok, show_output)
    437 
    438         if location:
--> 439             available_locations = _available_workspace_locations(subscription_id, auth)
    440             available_locations = [x.lower().replace(' ', '') for x in available_locations]
    441             location = location.lower().replace(' ', '')

~\.conda\envs\reco_pyspark\lib\site-packages\azureml\core\workspace.py in _available_workspace_locations(subscription_id, auth)
   1556     if not auth:
   1557         auth = InteractiveLoginAuthentication()
-> 1558     return _commands.available_workspace_locations(auth, subscription_id)

~\.conda\envs\reco_pyspark\lib\site-packages\azureml\_project\_commands.py in available_workspace_locations(auth, subscription_id)
    334     :rtype: list[str]
    335     """
--> 336     response = auth._get_service_client(ResourceManagementClient, subscription_id).providers.get(
    337         "Microsoft.MachineLearningServices")
    338     for resource_type in response.resource_types:

~\.conda\envs\reco_pyspark\lib\site-packages\azureml\core\authentication.py in _get_service_client(self, client_class, subscription_id, subscription_bound, base_url)
    150         return _get_service_client_using_arm_token(self, client_class, subscription_id,
    151                                                    subscription_bound=subscription_bound,
--> 152                                                    base_url=base_url)
    153 
    154     def signed_session(self, session=None):

~\.conda\envs\reco_pyspark\lib\site-packages\azureml\core\authentication.py in _get_service_client_using_arm_token(auth, client_class, subscription_id, subscription_bound, base_url)
   1620     else:
   1621         # converting subscription_id, which is string, to string because of weird python 2.7 errors.
-> 1622         client = client_class(adal_auth_object, str(subscription_id), base_url=base_url)
   1623     return client
   1624 

TypeError: __init__() takes 2 positional arguments but 3 were given
'''

4

1 回答 1

0

您是否尝试过使用Workspace.from_config()andconfig.json方法?查看此文档页面,了解如何设置您的环境。

于 2020-06-06T07:38:44.023 回答