添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I keep getting error, running commands in Jupyter notebook.

import azureml.core
from azureml.core import Workspace
ws = Workspace.from_config()
print('Ready to use Azure ML {} to work with {}'.format(azureml.core.VERSION, ws.name))

return RED text line number = 4 # Load the workspace from the saved config file
----> 5 ws = Workspace.from_config()
another line in RED = --> 292 resource_group=resource_group)

I seem to be unable to call the Workspace Class

I have tried these

  • print(Workspace.get('worksp_mike1')) fails with TypeError, _get_ambient_new() takes 1 positional argument but 2 were given
  • Workspace.get_details() ... return = TypeError: get_details() missing 1 required positional argument: 'self'
  • I have run this successfully = !pip install --upgrade azureml-sdk azureml-widgets
  • this also runs OK, print("SDK version:", azureml.core.VERSION) = SDK version: 1.21.0
  • I get the same ws error in previous modules....
  • this is where I am, module 08 in Jupyter, " Create a Pipeline "
    https://microsoftlearning.github.io/mslearn-dp100/

    @MikeRichardson-3493 In this case it looks like the step wants to load a workspace from a config file. The config file will contain the subscription id, resource group and workspace name and when you run Workspace.from_config() the details are loaded from this file and used in the next cells. A configuration sample notebook is available here to setup and you can try to create this and load the workspace details and use them.

    from azureml.core import Workspace  
    subscription_id = "<my-subscription-id>"  
    resource_group = "<my-resource-group>"  
    workspace_name = "<my-workspace-name>"  
    ws = Workspace(subscription_id = subscription_id, resource_group = resource_group, workspace_name = workspace_name)  
    ws.write_config()  
    												

    thanks, it seems not to work for me. I got the output, "Workspace not accessible. Change your parameters or create a new workspace below"

    Is there a way to start over from Azure? like a format all, full reset? I've have tried "Restore default settings" in Azure, but my workspace is still here. thank you.

    Thank you. I deleted and then recreated all new. for example, this mslearn module now ran without error, "01 - Get Started with Notebooks"
    from azureml.core import Workspace
    ws = Workspace.from_config()
    print(ws.name, "loaded")
    mydp100 loaded

    I'm not sure what the actual issue is, as I was also initially unable to run the code block which instantiates the Workspace object, and was getting the same error as the OP.

    This was when I cloned the repository into an Azure ML workspace I had previously created.

    To fix it, I created a new workspace (https://microsoftlearning.github.io/mslearn-dp100/instructions/01-create-a-workspace.html) and cloned the git repository for the learning path as specified, and then it somehow worked fine.

    I did not need to add the config file - from my understanding, you should only need to do that if you're using the SDK on your own machine, not if you're accessing Jupyter for your workspace via ML studio.