Aliyun Python SDK Core
raw JSON → 2.16.0 verified Mon Apr 06 auth: no python install: verified quickstart: verified maintenance
The `aliyun-python-sdk-core` is the foundational module of the Alibaba Cloud Python SDK (V1.0). It provides essential functionalities such as the client object, signature logic, and common exception handling, simplifying the process of integrating Python applications with various Alibaba Cloud services. While still actively maintained for security, new feature development has ceased, and Alibaba Cloud recommends migrating new projects to the V2.0 SDK for enhanced performance and features.
pip install aliyun-python-sdk-core Common errors
error ModuleNotFoundError: No module named 'aliyunsdkcore.vendored.six.moves' ↓
cause The 'six' module is missing or incompatible, leading to the SDK's inability to locate 'six.moves'.
fix
Install or upgrade the 'six' module using 'pip install --upgrade --force-reinstall six'.
error ImportError: No module named 'aliyunsdkcore' ↓
cause The 'aliyun-python-sdk-core' package is not installed or not properly installed in the Python environment.
fix
Install the package using 'pip install aliyun-python-sdk-core'.
error ModuleNotFoundError: No module named 'aliyunsdkcore' ↓
cause The 'aliyun-python-sdk-core' package is missing from the Python environment.
fix
Install the package using 'pip install aliyun-python-sdk-core'.
error Error:MissingParameter The input parameter "AccessKeyId" that is mandatory for processing this request is not supplied. ↓
cause This error indicates that the AccessKeyId or AccessKeySecret required for authentication with Alibaba Cloud services were not provided during the `AcsClient` initialization or are not configured as environment variables.
fix
Set the
ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables, or pass them directly as arguments when creating the AcsClient instance: client = AcsClient('YOUR_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY_SECRET', 'cn-hangzhou'). error aliyunsdkcore.acs_exception.exceptions.ClientException: SDK.InvalidParameter The parameter region_id not match with ^[a-zA-Z0-9_-]+$. ↓
cause This `ClientException` arises when the `region_id` provided during the `AcsClient` initialization is in an invalid format or does not correspond to a valid Alibaba Cloud region, or if an outdated SDK core package cannot identify the endpoint.
fix
Use a valid region ID in the
cn-<Region> format (e.g., 'cn-hangzhou') and ensure your aliyun-python-sdk-core package is updated to the latest version via pip install --upgrade aliyun-python-sdk-core. Warnings
breaking The `aliyun-python-sdk-core` (V1.0 SDK) is entering a basic security maintenance phase and will not receive new features. Alibaba Cloud strongly recommends migrating new projects to the V2.0 SDK (`alibabacloud-python-sdk`) for better performance, a more concise API, and continued feature development. ↓
fix For new projects, use `pip install alibabacloud-python-sdk` and refer to the V2.0 documentation. For existing projects, consider a migration strategy.
breaking Starting from version 2.16.0, `aliyun-python-sdk-core` officially requires Python 3.7 or higher. Earlier versions supported Python 2.7 and various Python 3.x versions. ↓
fix Ensure your Python environment is 3.7 or newer. Upgrade Python if necessary, or pin to an earlier SDK version if legacy Python is unavoidable.
gotcha Incorrect `region_id` format during `AcsClient` initialization can lead to `SDK.MissingEndpointsFiler` or other endpoint resolution errors. Region IDs must follow the `cn-<Region>` or equivalent cloud-specific format. ↓
fix Always use a valid and correctly formatted region ID (e.g., 'cn-hangzhou', 'ap-southeast-1'). Refer to Alibaba Cloud documentation for available regions.
gotcha ModuleNotFoundError for SDK components or persistent installation issues can be caused by outdated `pip` or `setuptools`, or Python version conflicts. ↓
fix Ensure `pip` and `setuptools` are up-to-date (`pip install --upgrade pip setuptools`). If multiple Python versions are installed, ensure the SDK is installed for the correct interpreter (e.g., `pip3 install ...`). Clear pip cache if issues persist (`pip cache purge`).
Install compatibility verified last tested: 2026-04-06
runtime status import time mem disk
3.10-alpine 0.34s 12.0MB 38.1M
3.10-slim 0.23s 12.0MB 38M
3.11-alpine 0.52s 12.8MB 41.0M
3.11-slim 0.39s 12.8MB 41M
3.12-alpine 0.41s 12.8MB 30.8M
3.12-slim 0.41s 12.8MB 31M
3.13-alpine 0.39s 13.1MB 30.5M
3.13-slim 0.40s 13.1MB 31M
3.9-alpine 0.32s 12.2MB 38.4M
3.9-slim 0.30s 12.2MB 39M
Imports
- AcsClient
from aliyunsdkcore.client import AcsClient - ClientException
from aliyunsdkcore.acs_exception.exceptions import ClientException - ServerException
from aliyunsdkcore.acs_exception.exceptions import ServerException
Quickstart verified last tested: 2026-04-23
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException, ServerException
ACCESS_KEY_ID = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY_ID')
ACCESS_KEY_SECRET = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', 'YOUR_ACCESS_KEY_SECRET')
REGION_ID = os.environ.get('ALIBABA_CLOUD_REGION_ID', 'cn-hangzhou') # e.g., 'cn-hangzhou'
try:
# Initialize the AcsClient instance
client = AcsClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET, REGION_ID)
print(f"AcsClient initialized successfully for region {REGION_ID}")
# In a real scenario, you would then create a request object for a specific service
# and send it using client.do_action_with_exception(request)
# For example:
# from aliyunsdkecs.request.v20140526 import DescribeRegionsRequest
# request = DescribeRegionsRequest.DescribeRegionsRequest()
# response = client.do_action_with_exception(request)
# print(response.decode('utf-8'))
except ClientException as e:
print(f"Client Error: {e.error_code} - {e.message}")
except ServerException as e:
print(f"Server Error: {e.error_code} - {e.message}")
except Exception as e:
print(f"An unexpected error occurred: {e}")