What are Azure Machine Learning environments?
APPLIES TO: Basic edition Enterprise edition (Upgrade to Enterprise edition)
Azure Machine Learning environments specify the Python packages, environment variables, and software settings around your training and scoring scripts. They also specify run times (Python, Spark, or Docker). They are managed and versioned entities within your Machine Learning workspace that enable reproducible, auditable, and portable machine learning workflows across a variety of compute targets.
You can use an
Environment object on your local compute to:
- Develop your training script.
- Reuse the same environment on Azure Machine Learning Compute for model training at scale.
- Deploy your model with that same environment.
The following diagram illustrates how you can use a single
Environment object in both your run configuration, for training, and your inference and deployment configuration, for web service deployments.
Types of environments
Environments can broadly be divided into three categories: curated, user-managed, and system-managed.
Curated environments are provided by Azure Machine Learning and are available in your workspace by default. They contain collections of Python packages and settings to help you get started with various machine learning frameworks.
In user-managed environments, you're responsible for setting up your environment and installing every package that your training script needs on the compute target. Conda doesn't check your environment or install anything for you. If you're defining your own environment, you must list
azureml-defaults with version
>= 1.0.45 as a pip dependency. This package contains the functionality that's needed to host the model as a web service.
You use system-managed environments when you want Conda to manage the Python environment and the script dependencies for you. The service assumes this type of environment by default, because of its usefulness on remote compute targets that are not manually configurable.
Create and manage environments
You can create environments by:
- Defining new
Environmentobjects, either by using a curated environment or by defining your own dependencies.
- Using existing
Environmentobjects from your workspace. This approach allows for consistency and reproducibility with your dependencies.
- Importing from an existing Anaconda environment definition.
- Using the Azure Machine Learning CLI
For specific code samples, see the "Create an environment" section of Reuse environments for training and deployment. Environments are also easily managed through your workspace. They include the following functionality:
- Environments are automatically registered to your workspace when you submit an experiment. They can also be manually registered.
- You can fetch environments from your workspace to use for training or deployment, or to make edits to the environment definition.
- With versioning, you can see changes to your environments over time, which ensures reproducibility.
- You can build Docker images automatically from your environments.
For code samples, see the "Manage environments" section of Reuse environments for training and deployment.