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.
Command reference: Watson Machine Learning CLI
Tip If this is the first time you have set up the Watson Machine Learning CLI environment, review key terms.
Before you begin
- Sign up for an IBM Cloud account
See: IBM Cloud registration
- Create an instance of Watson Machine Learning
See: Watson Machine Learning in the IBM Cloud catalog
Perform these steps on your computer:
- Install the IBM Cloud CLI
- Install the machine-learning plugin
- Set environment variables
- Login and test
1. Install the IBM Cloud CLI
Install the IBM Cloud command line interface (CLI) on your computer.
2. Install the machine-learning plugin
From a command line on your computer, install the machine-learning plugin:
bx plugin install machine-learning
3. Set environment variables
3.1 Collect service credentials
Look up the
instance_id elements of your Watson Machine Learning service credentials.
3.2 Set variables
On your computer, set environment variables that the machine learning plugin requires:
|Environment variable||Service credentials element|
Example: Setting variables for the current session on the Windows command line
set ML_ENV=https://us-south.ml.cloud.ibm.com set ML_USERNAME=23d59ab1-72ea-38cd-7410-dd1790da35f9 set ML_PASSWORD=16382469-2481-d57a-e731-e582a78b2d78 set ML_INSTANCE=57a283db-452f-c359-00d4-8c3461a7b90e
Example: Setting variables for the current session on Linux or macOS
export ML_ENV=https://us-south.ml.cloud.ibm.com export ML_USERNAME=23d59ab1-72ea-38cd-7410-dd1790da35f9 export ML_PASSWORD=16382469-2481-d57a-e731-e582a78b2d78 export ML_INSTANCE=57a283db-452f-c359-00d4-8c3461a7b90e
(Replace these example values with ones for your service instance.)
4. Log in and test
4.1 Log in
From a command line on your computer, log in to IBM Cloud:
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.
Run a test Watson Machine Learning command:
bx ml list training-runs
Fetching the list of training runs ... SI No Name guid status framework version submitted-at 0 records found. OK 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.)