IBM Cloud VPC Python SDK
raw JSON → 0.33.0 verified Mon Apr 27 auth: no python
Python client library for IBM Cloud Virtual Private Cloud (VPC) services. Current version 0.33.0, released April 2026. Follows IBM Cloud API spec updates; released roughly quarterly.
pip install ibm-vpc Common errors
error ModuleNotFoundError: No module named 'ibm_vpc' ↓
cause Package not installed or installed with wrong name.
fix
Run 'pip install ibm-vpc' (hyphen, not underscore).
error Unauthorized: Access denied (401) ↓
cause Invalid API key or missing permissions.
fix
Verify IBM_CLOUD_API_KEY is set correctly and has IAM access to VPC services.
error AttributeError: module 'ibm_vpc' has no attribute 'VpcV1' ↓
cause Incorrect import path after version changes.
fix
Use 'from ibm_vpc import VpcV1' (top-level import).
error ibm_cloud_sdk_core.api_exception.ApiException: Error: Resource not found (404) ↓
cause Service URL or region is incorrect.
fix
Set correct service URL for your region, e.g., service.set_service_url_for_region('us-south').
Warnings
breaking Service URL changed from 'https://{region}.iaas.cloud.ibm.com/v1' to use set_service_url_for_region() in v0.28.0. Hardcoded URLs may break if region changes. ↓
fix Use service.set_service_url_for_region('us-south') instead of constructing URL manually.
breaking Default API version updated from 2025-03-04 to 2025-04-22 in v0.28.0. Some response fields may have changed. ↓
fix Set explicit API version via set_headers or pass version parameter if you relied on old defaults.
gotcha Creating a VPC requires a resource_group.id; omitting it may cause a 400 error. ↓
fix Always include resource_group with a valid ID in the prototype.
deprecated The 'owner_type' parameter in list_images was enhanced in v0.28.0. Old filter values may not work as expected. ↓
fix Check the latest API spec for valid owner_type values.
Imports
- VpcV1 wrong
from ibm_vpc.vpc_v1 import VpcV1correctfrom ibm_vpc import VpcV1 - IamAuthenticator wrong
from ibm_vpc import IamAuthenticatorcorrectfrom ibm_cloud_sdk_core.authenticators import IamAuthenticator
Quickstart
import os
from ibm_vpc import VpcV1
from ibm_cloud_sdk_core.authenticators import IamAuthenticator
authenticator = IamAuthenticator(
apikey=os.environ.get('IBM_CLOUD_API_KEY', '')
)
service = VpcV1(authenticator=authenticator)
service.set_service_url('https://us-south.iaas.cloud.ibm.com/v1')
vpc_prototype = {
'name': 'my-vpc',
'resource_group': {'id': 'your-resource-group-id'}
}
response = service.create_vpc(vpc_prototype)
print(response.get_result())