Install & Compatibility
Where this runs
tested against v3.1.3 · 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.298s · 39.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.9s · import 0.284s · 40MB
37MB installed
● package 37MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
StsRequest
✓ from aliyunsdksts.request.v20150401 import AssumeRoleRequest
✗ import sts
Wrong import; the SDK uses the full request class.
StsClient
✓ from aliyunsdkcore.client import AcsClient
✗ from aliyunsdksts.client import AcsClient
The client is from aliyunsdkcore, not from the sts package.
Assume a role using STS to get temporary credentials.
from aliyunsdkcore.client import AcsClient
from aliyunsdksts.request.v20150401 import AssumeRoleRequest
import json
client = AcsClient(
os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),
os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', ''),
'cn-hangzhou'
)
request = AssumeRoleRequest()
request.set_RoleArn('acs:ram::1234567890:role/ecsbackup')
request.set_RoleSessionName('session-test')
response = client.do_action_with_exception(request)
print(json.loads(response))
Errors
Common errors & fixes
ImportError: No module named 'aliyunsdkcore'
Missing dependency aliyun-python-sdk-core.
fixRun: pip install aliyun-python-sdk-core
AttributeError: module 'aliyunsdksts' has no attribute 'request'
Wrong import statement; trying to import the module instead of the request class.
fixUse: from aliyunsdksts.request.v20150401 import AssumeRoleRequest
aliyunsdkcore.exception.ServerException: HTTP Status: 404 Error: InvalidParameter.RoleArn
RoleArn parameter is missing or incorrectly formatted.
fixEnsure RoleArn is set with the correct format: acs:ram::<account-id>:role/<role-name>
Upgrade
Version history
3.1.3latest on PyPI · released Jun 30, 2025
Audit
Dependencies
aliyun-python-sdk-corerequiredRequired for Alibaba Cloud SDK infrastructure; not automatically installed by this package.