{"id":9044,"library":"ibm-watson-machine-learning","title":"IBM Watson Machine Learning Client","description":"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.","status":"maintenance","version":"1.0.368","language":"en","source_language":"en","source_url":"https://pypi.org/project/ibm-watson-machine-learning/","tags":["IBM Cloud","Watson Machine Learning","AI","Machine Learning","Deployment","Model Management","Cloud Pak for Data"],"install":[{"cmd":"pip install ibm-watson-machine-learning","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The APIClient class is nested within the APIClient module, requiring a more specific import path.","wrong":"from ibm_watson_machine_learning import APIClient","symbol":"APIClient","correct":"from ibm_watson_machine_learning.APIClient import APIClient"}],"quickstart":{"code":"import os\nfrom ibm_watson_machine_learning.APIClient import APIClient\n\n# --- IMPORTANT: This library is in maintenance mode. Consider ibm-watsonx-ai ---\n\n# Replace with your IBM Cloud API Key and Watson Machine Learning service endpoint.\n# For IBM Cloud: API_KEY and the service_endpoint (e.g., 'https://us-south.ml.cloud.ibm.com')\n# For Cloud Pak for Data: USERNAME, PASSWORD, and service_endpoint (e.g., 'https://<your_cpd_cluster_host>')\n\n# Example for IBM Cloud (API Key authentication):\napi_key = os.environ.get('IBM_CLOUD_API_KEY', 'YOUR_IBM_CLOUD_API_KEY')\nservice_endpoint = os.environ.get('WML_SERVICE_ENDPOINT', 'https://us-south.ml.cloud.ibm.com') # Example endpoint\n\nif 'YOUR_IBM_CLOUD_API_KEY' in api_key or 'YOUR_CPD_CLUSTER_HOST' in service_endpoint:\n    print(\"Please set IBM_CLOUD_API_KEY and WML_SERVICE_ENDPOINT environment variables or replace placeholders.\")\nelse:\n    try:\n        wml_credentials = {\n            \"apikey\": api_key,\n            \"url\": service_endpoint\n        }\n\n        client = APIClient(wml_credentials)\n        print(\"IBM Watson Machine Learning client initialized successfully.\")\n        print(f\"Client version: {client.version}\")\n\n        # Example: Get spaces (requires a WML service instance and configured spaces)\n        # spaces = client.spaces.get_details()\n        # print(\"Available WML Spaces:\")\n        # for space in spaces['resources']:\n        #     print(f\"- {space['entity']['name']} (ID: {space['metadata']['id']})\")\n\n    except Exception as e:\n        print(f\"Error initializing WML client: {e}\")\n        print(\"Ensure your API key and service endpoint are correct and you have access to the service.\")","lang":"python","description":"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."},"warnings":[{"fix":"Migrate your code to use the `ibm-watsonx-ai` library. Refer to the official migration guides provided by IBM.","message":"The `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.","severity":"breaking","affected_versions":">=1.0.x"},{"fix":"Update your model types and software specifications to use Runtime 24.1 or a later supported version for deployments.","message":"Runtime 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.","severity":"breaking","affected_versions":"All versions deploying with Runtime 23.1"},{"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.","message":"Upgrading 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.","severity":"gotcha","affected_versions":"All versions, particularly during environment upgrades (e.g., Cloud Pak for Data upgrades)"},{"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.","message":"Batch 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'.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Update the runtime environment of your project to the latest supported version (e.g., Runtime 24.1 if the notebook used 23.1) and ensure adequate computing resources.","cause":"This error occurs when importing an AutoAI notebook from a catalog due to a mismatch between the notebook's saved runtime environment and the project's current runtime environment.","error":"Library not compatible or missing"},{"fix":"Update the constricted software specification for your deployed asset to use the latest supported version. Alternatively, if no longer needed, delete the application deployment.","cause":"Deployment failures after upgrading IBM Cloud Pak for Data (e.g., from 4.7.0 to 4.8.4) can be caused by outdated constricted software specifications for deployed assets.","error":"Error 502 - Bad Gateway"},{"fix":"Re-run the text extraction request. This often resolves transient deserialization issues.","cause":"This error can occur when running a text extraction request using the watsonx.ai REST API.","error":"IncompatibleVersionError('Failed to deserialize the batch output from bytes. The bytes input might be corrupted or produced by an incompatible version of WDU.')"},{"fix":"Add the WebSocket connection `wss://dataplatform.cloud.ibm.com` to your firewall settings to allow notebook connectivity.","cause":"When working with notebooks in Watson Studio behind a firewall, the firewall might be blocking the WebSocket connection required for the kernel.","error":"Connecting to Kernel... Connection failed. Reconnecting... connection failed error message"}]}