Install the Azure Machine Learning SDK for Python

This article is a guide for different installation options for the SDK.

Default install

The default installation covers a large number of use-cases and will not install any unnecessary native dependencies in your environment. The following native package structure will be installed via the azureml-sdk package without any extra components:

Note

When submitting runs, the SDK by default installs the azureml-defaults package to the environment where the run is executed. azureml-defaults contains the azureml-core and applicationinsights packages required for tasks such as logging metrics, uploading artifacts, and accessing data stores from within the run.

To install the default packages, run the following command.

pip install --upgrade azureml-sdk

Advanced install (extras)

The SDK contains several optional components (extras) that will only be installed if specified. These include dependencies that aren't required for all use-cases, so they are not included in the default installation in order to avoid bloating the environment. The following table outlines optional components and their use-cases.

Extra Use-cases and installed packages
accel-models Installs azureml-accel-models. Accelerates deep neural networks on FPGAs with the Azure ML Hardware Accelerated Models Service.
automl Installs azureml-train-automl and other required dependencies. Provides classes for building and running automated machine learning experiments. The automl extra also installs common data science packages including pandas, numpy, and scikit-learn. See the additional use-case guidance for more information on working with automl.
automl_databricks Allows usage of automl extra in a Databricks environment. This extra cannot be combined with other components.
contrib Installs azureml-contrib- variants. The azureml.contrib namespace changes frequently, as we work to improve the service. As such, anything in this namespace should be considered as a preview, and not fully supported by Microsoft.
databricks Installs non-native packages to ensure compatibility when working within an Azure Databricks environment. This extra cannot be combined with other components. See the additional use-case guidance for more information on using the SDK in an Azure Databricks environment.
explain Installs azureml-explain-model and other required dependencies. Includes classes for understanding detailed feature importance in automated model tuning.
notebooks Installs azureml-widgets and other required dependencies. Provides support for interactive widgets in a Jupyter notebook environment. This is unnecessary to install if you aren't running in a Jupyter notebook (ex. if you are building in PyCharm), or if you don't need widgets enabled.
services Installs azureml-contrib-services. Provides functionality for scoring scripts to request raw HTTP access.
tensorboard Installs azureml-tensorboard. Provides classes and methods for exporting experiment run history and launching TensorBoard for visualizing experiment performance and structure.

To install the SDK with extras, append the component name(s) in brackets onto the default install. For example, the following command installs the SDK with the explain and automl variants.

pip install --upgrade azureml-sdk[explain,automl]

If you want to run a custom install and manually manage the dependencies in your environment, you can individually install any package in the SDK.

Note

  • If you get a message that PyYAML can't be uninstalled, use the following command instead:

    pip install --upgrade azureml-sdk[explain,automl] --ignore-installed PyYAML

  • Starting with macOS Catalina, zsh (Z shell) is the default login shell and interactive shell. In zsh, use the following command which escapes brackets with "\" (backslash):

    pip install --upgrade azureml-sdk\[explain,automl\]

Check version

Run the following code to verify your SDK version. This check may be necessary for verifying compatibility with certain tutorials and code samples.

import azureml.core
print(azureml.core.VERSION)

To learn more about how to configure your development environment for Azure Machine Learning service, see Configure your development environment.

Additional use-case guidance

If your use-case is described below, note the guidance and any recommended actions.

Use-case Guidance
Using the automl extra. Install the SDK in a 64-bit Python environment. A 64-bit environment is required because of a dependency on the LightGBM framework.
Using Azure Databricks. In the Azure Databricks environment, use the library sources detailed in this guide for installing the SDK. Also, see these tips for further information on working with Azure Machine Learning SDK for Python on Azure Databricks.
Using Azure Data Science Virtual Machine. Azure Data Science Virtual Machines created after September 27, 2018 come with the Python SDK preinstalled.
Running Azure Machine Learning tutorials or notebooks. If you are using an older version of the SDK than the one mentioned in the tutorial or notebook, you should upgrade your SDK. Some functionality in the tutorials and notebooks may require additional Python packages such as matplotlib, sicikit-learn, or pandas. Instructions in each tutorial and notebook will show you which packages are required.

Next steps

Try these next steps to learn how to use the Azure Machine Learning service SDK for Python:

  1. Read the overview to learn about key classes and design patterns with code samples.
  2. Follow the quickstart to begin creating experiments and models.