Write Config file Issue

sumit gupta 26 Reputation points

I am trying to write config file created in the workspace using SDK.

Below is the error message along with the code :

ws = Workspace.create(name='XYZ',


serErrorException: UserErrorException:
Message: Could not write the config file to: /Users/sumit/Downloads/.azureml/check/.azureml
[Errno 2] No such file or directory: '/Users/sumit/Downloads/.azureml/check/.azureml'

Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
212 questions
{count} vote

Accepted answer
  1. AshokPeddakotla-MSFT 30,321 Reputation points

    @sumit gupta Config file path which you have specified is not available. You need to specify the path correctly to write to the config file.

    Please use the below code and update if that solves your issue.

    ws.write_config(path="./file-path", file_name="ws_config.json")  

    To load the workspace from the configuration file, use the from_config method.

      ws = Workspace.from_config()  

    If you ran the Azure Machine Learning quickstart in Azure Notebooks, you already have a configured workspace! You can go to your Azure Machine Learning Getting Started library, view config.json file, and copy-paste the values for subscription ID, resource group and workspace name below.

    Replace the default values in the cell below with your workspace parameters

    import os  
    subscription_id = os.getenv("SUBSCRIPTION_ID", default="<my-subscription-id>")  
    resource_group = os.getenv("RESOURCE_GROUP", default="<my-resource-group>")  
    workspace_name = os.getenv("WORKSPACE_NAME", default="<my-workspace-name>")  
    workspace_region = os.getenv("WORKSPACE_REGION", default="eastus2")  

    Write to config.json file

    from azureml.core import Workspace  
        ws = Workspace(subscription_id = subscription_id, resource_group = resource_group, workspace_name = workspace_name)  
        # write the details of the workspace to a configuration file to the notebook library  
        print("Workspace configuration succeeded. Skip the workspace creation steps below")  
        print("Workspace not accessible. Change your parameters or create a new workspace below")  

    Reference: Setting up your Azure Machine Learning services workspace and configuring your notebook library

    If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful