Install & Compatibility
Where this runs
tested against v2.16.1 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.394s · 38.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.0s · import 0.354s · 39MB
37MB installed
● package 37MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AcsClient
✓ from aliyunsdkcore.client import AcsClient
ClientException
✓ from aliyunsdkcore.acs_exception.exceptions import ClientException
ServerException
✓ from aliyunsdkcore.acs_exception.exceptions import ServerException
This quickstart demonstrates how to initialize the `AcsClient` with AccessKey credentials and a region ID. Credentials should ideally be managed via environment variables for security. After initialization, you would typically import and configure service-specific request objects and use the client to send API calls.
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}")
Debug
Known issues
breakingThe `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.fixFor new projects, use `pip install alibabacloud-python-sdk` and refer to the V2.0 documentation. For existing projects, consider a migration strategy.
affects: All versions of `aliyun-python-sdk-core` (V1.0)
breakingStarting 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.fixEnsure your Python environment is 3.7 or newer. Upgrade Python if necessary, or pin to an earlier SDK version if legacy Python is unavoidable.
affects: >=2.16.0
gotchaIncorrect `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.fixAlways use a valid and correctly formatted region ID (e.g., 'cn-hangzhou', 'ap-southeast-1'). Refer to Alibaba Cloud documentation for available regions.
affects: All versions
gotchaModuleNotFoundError for SDK components or persistent installation issues can be caused by outdated `pip` or `setuptools`, or Python version conflicts.fixEnsure `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`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aliyunsdkcore.vendored.six.moves'
The 'six' module is missing or incompatible, leading to the SDK's inability to locate 'six.moves'.
fixInstall or upgrade the 'six' module using 'pip install --upgrade --force-reinstall six'.
ImportError: No module named 'aliyunsdkcore'
The 'aliyun-python-sdk-core' package is not installed or not properly installed in the Python environment.
fixInstall the package using 'pip install aliyun-python-sdk-core'.
ModuleNotFoundError: No module named 'aliyunsdkcore'
The 'aliyun-python-sdk-core' package is missing from the Python environment.
fixInstall the package using 'pip install aliyun-python-sdk-core'.
Error:MissingParameter The input parameter "AccessKeyId" that is mandatory for processing this request is not supplied.
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.
fixSet 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')`. aliyunsdkcore.acs_exception.exceptions.ClientException: SDK.InvalidParameter The parameter region_id not match with ^[a-zA-Z0-9_-]+$.
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.
fixUse 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`.
Upgrade
Version history
2.16.1latest on PyPI · released Aug 18, 2026
Audit
Dependencies
cryptographyrequiredUsed for secure communication and cryptographic operations within the SDK.
jmespathrequiredUsed for querying JSON data, potentially for parsing API responses.