How to resolve error - Creating conda environment failed with exit code: 1?

Jeswin George 6 Reputation points

I am getting this error when I run script I do not know how to debug this issue, would appreciate help to solve this.

PS: I have just started learning azure so I am not sure what I am missing.


   from azureml.core import Workspace, Dataset, Run  
   ws = Workspace.from_config()  
   az_dataset = Dataset.get_by_name(workspace=ws, name='titanic-dataset')  
   # Get the context of the experiment  
   new_run = Run.get_context()  
   df = az_dataset.to_pandas_dataframe()  
   ### count the observations  
   total_obs = len(df)  
   ### get the gender count  
   gender_count = df['Sex'].value_counts()  
   # log the metrics to workspace  
   new_run.log(name = "Total observations", value = total_obs)  
   ### Log the gender data values  
   for val in df['Sex'].unique():  
       new_run.log(name = val, value = gender_count[val])  
   # complete an experiment run  

   from azureml.core import Workspace, Datastore, Dataset, Experiment, ScriptRunConfig, Environment  
   # Access workspace  
   ws = Workspace.from_config()  
   # create an experiment object  
   exp = Experiment(workspace=ws, name = "Titanic_exp")  
   # create custom env - myenv  
   myenv = Environment(name = 'MyEnvironment')  
   # to install dependencies  
   from azureml.core.environment import CondaDependencies  
   # from CondaDependencies class we need to create an object which will have all the required dependencies  
   # create the dependencies object  
   packages = CondaDependencies.create(conda_packages=['pandas', 'scikit-learn']) # this will have list of all packages we will need  
   myenv.python.conda_dependencies = packages # this will tell to install the packages  
   # register environment to workspace so that we have access to it  
   # create a script configuration for custom env  
   script_config = ScriptRunConfig(source_directory = '.', script = "", environment = myenv)  
   new_run = exp.submit(config = script_config)  
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,602 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Jeswin George 6 Reputation points

    Hi @Ramr-msft thanks for replying.
    I am following this link to learn azureml: 4-azure-ml-experiment

    I did the following steps:

    1. Created the workspace, downloaded the config.json file and uploaded it in the .azureml folder created by me.
    2. I was able to successfully run this script using experiment.start_logging() function as given in the module. 125680-temp1.png
    3. The problem comes when i try to run the script as an experiment using Run.get_context()125769-60-control-log.txt
    4. I am attaching the 60_control_log.txt for reference.

    Please let me know if this answers your question and helps you to figure out the issue.

    0 comments No comments

  2. Andrius Bertulis 1 Reputation point

    Hey, I was having the same issue. resolved in two steps, however i think you can skip step 1

    -- step 1 (not sure if this actually had any impact but did not retest with default setup)
    I have modified the environment.yml fiIe and specified a python version as 3.8.10
    -- step 2 (I think this did the trick)
    Created new compute instance and rerun

    Hope same works for you

    0 comments No comments