Setting up your local environment for using the Watson Machine Learning CLI

You can work with your IBM Watson Machine Learning service using a command line interface on your computer.

Note: The Watson Machine Learning CLI is deprecated and is only available for working with assets created with a V1 machine learning service instance. Refer to these topics for more information:

Accessing the CLI command reference

Command reference: Watson Machine Learning CLI external link

Tip If this is the first time you have set up the Watson Machine Learning CLI environment, review key terms.

Before you begin

  1. Sign up for an IBM Cloud account
    See: IBM Cloud registration external link
  2. Create an instance of Watson Machine Learning
    See: Watson Machine Learning in the IBM Cloud catalog external link


Perform these steps on your computer:

  1. Install the IBM Cloud CLI
  2. Install the machine-learning plugin
  3. Authenticate
  4. Login and test

1. Install the IBM Cloud CLI

Install the IBM Cloud command line interface (CLI) on your computer.

See: IBM Cloud CLI download page external link

2. Install the machine-learning plugin

From a command line on your computer, install the machine-learning plugin:

ibmcloud plugin install machine-learning

See: IBM Cloud CLI plugin install command reference external link

3. Authenticate

See: Watson Machine Learning CLI authentication

4. Log in and test

4.1 Log in

From a command line on your computer, log in to IBM Cloud:

ibmcloud login

See: IBM Cloud CLI login command reference external link

Tip The login command prompts you to specify your API endpoint. You can look up your Region on your IBM Cloud dashboard, and then select the API endpoint for that region from the prompt.

4.2 Find and set instance

Find and specify your Watson Machine Learning instance. Enter:

ibmcloud ml list instances

This lists all Machine Learning instances available in the region and account that you selected. Note the instance ID and set it with this command:

ibmcloud ml set instance <instance-id>

4.3 Test

Run a test Watson Machine Learning command:

ibmcloud ml list training-runs

Sample output

Fetching the list of training runs ...
SI No   Name   guid   status   framework   version   submitted-at

0 records found.
List all training-runs successful

(Because no training runs have been started, you would not expect to see any runs listed. The most important part of this output is that the command completed successfully.)