MS Azure Machine Learning Prerequisites

 

Prerequisites

Required Applications:

  • Anaconda Console (Miniconda)
    • This automatically installs Python and PIP
  • Administrator rights on the local machine (to install the program as an Administrator)

How to Install Miniconda

Miniconda is a free minimal installer for Conda.

It is later used to install and activate Azure Machine Learning.

  1. Install Miniconda for separate virtual python environments:
    1. Available for download from https://repo.anaconda.com/miniconda 
      • Do not install Python 3.9.
    2. The Latest version of Python supported is Miniconda3-py38_4.11.0)
  2. Right-click the downloaded .exe file and run it as an Administrator.
  3. Install the application using the Installation wizard.
    1. Check both options:
      1. "Add Miniconda to my PATH environment variable"
      2. "Register Miniconda as my default Python"
    2. If you choose not to add the PATH environment variables or register default Python, then the scripted installation may not work and will require manual changes to your environment.
      1. If at install time "Add Miniconda to my PATH environment variable" is not available, after installation is finished, you can perform either of the following steps:
        1. Run AddMinicondaEnvVariablesToPath.ps1 from the AzureMLPythonRestAPI folder in the BA Insight <AutoClassifier_engine_install_root>\Admin Site directory.
        2. Manually add Miniconda environment variables to Path (use the steps below)
          1. Open the Windows Start window
          2. Search for "Edit the system environment variables"

          3. Open Edit the system environment variables → Advanced → Environment Variables

          4. Select Path → Path → Edit → New and add the following variables:
          • C:\ProgramData\Miniconda3
          • C:\ProgramData\Miniconda3\Library\mingw-w64\bin
          • C:\ProgramData\Miniconda3\Library\usr\bin
          • C:\ProgramData\Miniconda3\Library\bin
          • C:\ProgramData\Miniconda3\Scripts


Info: In some cases files pythoncom38.dll and pywintypes38.dll are not copied to System32 folder.

In this case, this must be done manually. 

  1. Locate the folder "pywin32_system32" in the Miniconda3 directory.
    1. Default location (C:\ProgramData\Miniconda3\Lib\site-packages\pywin32_system32)
  2. Copy both DLL files (pythoncom38.dll, pywintypes38.dll)
  3. Paste them into the directory C:\Windows\System32

Error/Solution:

You may receive an error similar to the following:

  • "ImportError: DLL load failed while importing win32file: The specified procedure could not be found." .

If that occurs:

  1. Open Miniconda (Conda)

  2. Run the command: conda install pywin32


**Read the Upgrade section below if you are both:
  • Upgrading from AutoClassifier version 6.3.1.0-cd89f9c or earlier

  • Using Microsoft Azure Machine Learning for tagging

How to Install and Activate MS Azure Machine Learning Environment

Info: The Azure Application created above must be added as Contributor to Azure Machine Learning.
  1. Go to your Azure Machine Learning App

  2. Click Access control (IAM)

  3. Click View access to this resource

  4. Click Add → Add role assignment

  5. Select Contributor and then Next

  6. Click Select members and search for your app

  7. Click Review and Assign

Locate the AzureMLPythonRestAPI folder in the BA Insight <AutoClassifier_engine_install_root>\Admin Site directory.
The files inside this folder are used during the following installation process:

  1. Open Windows PowerShell as an Administrator
  2. Navigate to the directory PythonRestAPIWrapper
    1. Run command cd "your path to AzureMLPythonRestAPI"
  3. Make sure to check if port 1989 is available.
    1. If port 1989 is in use, find available port and update AzureMLTrainer.py with available port.
  4. Run the following script file: SetupAzureMLPythonEnv.ps1
  5. When prompted to proceed, enter 'y' for Yes
  6. Wait until all the libraries are installed and the windows service is configured
  7. After the script finished to run, go to Windows Service and check if BA Insight AutoClassifier Python API is created and it has the status "Running."

How to Create a Machine Learning Workspace and a Compute Cluster

Prerequisites:

  • Machine Learning workspace.
    • Follow the steps from here to create a ML Workspace

Create Compute Cluster:

  1. If you didn't select Go to workspacein the previous section, sign in to Azure Machine Learning studio now, and select your workspace.
  2. On the left side, select Compute.
  3. Select Compute clusters
  4. Select +New to create a new compute cluster instance. (It is recommended you use STANDARD_DS11_V2 or higher in performance for the compute cluster VM size). 
  5. Supply a name, and choose the options based on your needs.
    1. More information can be found here
  6. Select Create.

How to Create an Azure Application for Authentication

You need this app for Azure ML Provider configuration to authenticate to a Machine Learning Resource:

  1. Go to the Azure portal.
  2. Go to Azure Active Directory > App registration > New registration.
  3. Add a Name for your App
  4. Choose Accounts in this organization directory Only and click Register
  5. After the app is created, go to Certificates & secrets
  6. Click Client secrets → New client secret
  7. Choose the period for expiration time
  8. Save in a text editor the secret ID.
    1. This is used to configure AzureML Provider.

The Azure Application created above must be added as a Contributor to Azure Machine Learning.

Procedure:

  1. Go to your Azure Machine Learning App
  2. Click Access control (IAM)
  3. Click View access to this resource
  4. Click Add → Add role assignment
  5. Select Contributor and click Next.
  6. Click Select members and search for your app
  7. Click Review and Assign

Upgrade

If you are upgrading from version 6.3.1.0-cd89f9c or earlier perform the following steps to continue using Azure ML classification (after performing the regular upgrade steps):

  1. Stop the "BA Insight AutoClassifier Python API" Windows service if it is not already

  2. Open Miniconda / Anaconda.

  3. Run the command below:

    • pip install azureml-train-automl-client==1.50.0

  4. Wait for the dependencies upgrade to be completed

  5. Start the "BA Insight AutoClassifier Python API" Windows service

  6. Continue using the MS Azure Machine Learning functionalities.