Install the Azure ML SDK for R

2020-02-05

This article covers the step-by-step instructions for installing the Azure ML SDK for R.

You do not need run this if you are working on an Azure Machine Learning Compute Instance, as the compute instance already has the Azure ML SDK preinstalled.

Install Conda

If you do not have Conda already installed on your machine, you will first need to install it, since the Azure ML R SDK uses reticulate to bind to the Python SDK. We recommend installing Miniconda, which is a smaller, lightweight version of Anaconda. Choose the 64-bit binary for Python 3.5 or later.

Install the azuremlsdk R package

The stable release of the Azure ML SDK can be installed from CRAN or the development version can be installed from GitHub. You will need remotes to install the azuremlsdk package.

install.packages('remotes')

Then, you can use the install_github or install_cran functions to install the package.

remotes::install_github('https://github.com/Azure/azureml-sdk-for-r')

remotes::install_cran('azuremlsdk', repos = 'https://cloud.r-project.org/')

If you are using R installed from CRAN, which comes with 32-bit and 64-bit binaries, you may need to specify the parameter INSTALL_opts=c("--no-multiarch") to only build for the current 64-bit architecture.

remotes::install_cran('azuremlsdk', repos = 'https://cloud.r-project.org/', INSTALL_opts=c("--no-multiarch"))

Install the Azure ML Python SDK

Lastly, use the azuremlsdk R library to install the latest version of the Python SDK.

If using an Azure Machine Learning Compute Instance or a CRAN installation with reticulate >= 1.14, use the azuremlsdk::install_azureml() function with the conda environment set to r-reticulate.

azuremlsdk::install_azureml(envname = 'r-reticulate')

If using a CRAN installation with reticulate < 1.14 or a GitHub installation, the correct conda environment will be selected automatically. There is no need to specify the envname parameter.

azuremlsdk::install_azureml()

If you would like to override the default version, environment name, or Python version, you can pass in those arguments. If you would like to restart the R session after installation or delete the conda environment if it already exists and create a new environment, you can also do so:

azuremlsdk::install_azureml(version = NULL, 
                            envname = "<your conda environment name>",
                            conda_python_version = "<desired python version>",
                            restart_session = TRUE,
                            remove_existing_env = TRUE)

Test installation

You can confirm your installation worked by loading the library and successfully retrieving a run.

library(azuremlsdk)
get_current_run()

Troubleshooting