Registry / ai-ml / ibm-watson-machine-learning

ibm-watson-machine-learning

JSON →
library1.0.368pypypiunverified

The `ibm-watson-machine-learning` library provides a Python API client for interacting with the IBM Watson Machine Learning service on IBM Cloud and IBM Cloud Pak for Data. It enables users to programmatically train, test, store, and deploy machine learning models as APIs. The library is currently in maintenance mode (as of IBM Cloud Pak for Data 5.0.x, June 2024), with a recommendation to migrate to the `ibm-watsonx-ai` package for enhanced functionalities.

pip install ibm-watson-machine-learning
INSTALL
IMPORT
SIG · IBM-WATSON-MACHINE
I
ibm-watson-machine-learning
ai-mlpythonv1.0.368
Install
12.3s avg
Import
Disk
197MB
Pass rate
7/ 10
Env Coverage7 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.368 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 11.25s
py 3.11
✓ —
✓ 10.8s
py 3.12
✓ —
✓ 14.45s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 12.85s
197MB installed
● package 197MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

APIClient
from ibm_watson_machine_learning.APIClient import APIClient
from ibm_watson_machine_learning import APIClient
The APIClient class is nested within the APIClient module, requiring a more specific import path.

This quickstart demonstrates how to initialize the `APIClient` for the IBM Watson Machine Learning service. It assumes you have an IBM Cloud API Key and the service endpoint URL, or equivalent credentials for IBM Cloud Pak for Data. The code includes placeholders for environment variables or direct replacement. Successful initialization means the client can then be used to interact with various WML functionalities like managing models, deployments, and experiments.

import os from ibm_watson_machine_learning.APIClient import APIClient # --- IMPORTANT: This library is in maintenance mode. Consider ibm-watsonx-ai --- # Replace with your IBM Cloud API Key and Watson Machine Learning service endpoint. # For IBM Cloud: API_KEY and the service_endpoint (e.g., 'https://us-south.ml.cloud.ibm.com') # For Cloud Pak for Data: USERNAME, PASSWORD, and service_endpoint (e.g., 'https://<your_cpd_cluster_host>') # Example for IBM Cloud (API Key authentication): api_key = os.environ.get('IBM_CLOUD_API_KEY', 'YOUR_IBM_CLOUD_API_KEY') service_endpoint = os.environ.get('WML_SERVICE_ENDPOINT', 'https://us-south.ml.cloud.ibm.com') # Example endpoint if 'YOUR_IBM_CLOUD_API_KEY' in api_key or 'YOUR_CPD_CLUSTER_HOST' in service_endpoint: print("Please set IBM_CLOUD_API_KEY and WML_SERVICE_ENDPOINT environment variables or replace placeholders.") else: try: wml_credentials = { "apikey": api_key, "url": service_endpoint } client = APIClient(wml_credentials) print("IBM Watson Machine Learning client initialized successfully.") print(f"Client version: {client.version}") # Example: Get spaces (requires a WML service instance and configured spaces) # spaces = client.spaces.get_details() # print("Available WML Spaces:") # for space in spaces['resources']: # print(f"- {space['entity']['name']} (ID: {space['metadata']['id']})") except Exception as e: print(f"Error initializing WML client: {e}") print("Ensure your API key and service endpoint are correct and you have access to the service.")
Debug
Known issues
breakingThe `ibm-watson-machine-learning` package is in maintenance mode and is deprecated as of IBM Cloud Pak for Data 5.0.x (June 2024). IBM recommends migrating to the `ibm-watsonx-ai` package for new development and enhanced functionalities.
fix
Migrate your code to use the `ibm-watsonx-ai` library. Refer to the official migration guides provided by IBM.
affects: >=1.0.x
breakingRuntime 23.1 for deploying AI assets has been discontinued. Model types and software specifications deployed with Runtime 23.1 will no longer function, potentially leading to deployment failures.
fix
Update your model types and software specifications to use Runtime 24.1 or a later supported version for deployments.
affects: All versions deploying with Runtime 23.1
gotchaUpgrading Watson Machine Learning, especially within IBM Cloud Pak for Data environments, may fail due to runtime errors, orphaned objects, or issues with include_vars tasks.
fix
Consult IBM's 'Known issues and limitations' documentation for specific upgrade scenarios and workarounds. Ensure all dependencies and components are at compatible versions during upgrades.
affects: All versions, particularly during environment upgrades (e.g., Cloud Pak for Data upgrades)
gotchaBatch deployments that process large volumes of data as input might fail due to internal timeout settings, resulting in errors like 'Incorrect input data: Flight returned internal error'.
fix
Optimize your data input size for batch jobs or explore alternative deployment strategies if large data volumes consistently cause timeouts. Check service limits and consider breaking down large jobs.
affects: All versions
Upgrade
Version history
1.0.368latest on PyPI · released Jun 25, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
ibm-watson-machine-learning — pip install ibm-watson-machine-learning · libregistry