Install & Compatibility
Where this runs
tested against v3.9.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.402s · 56.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.7s · import 0.366s · 57MB
56MB installed
● package 56MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Provider
✓ from libcloud.compute.types import Provider
Import specific cloud provider types from the relevant service module (e.g., compute, storage, dns).
get_driver
✓ from libcloud.compute.providers import get_driver
Use 'get_driver' from the 'providers' submodule of the desired service API.
This quickstart demonstrates how to connect to a cloud provider (Rackspace in this example) using the Libcloud Compute API. It shows how to obtain a driver, authenticate using environment variables, and list available server sizes and images. Remember to replace placeholder credentials with your actual API keys and username, preferably loaded from environment variables for security.
import os
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
# Set your credentials using environment variables for security
RACKSPACE_USER = os.environ.get('RACKSPACE_USERNAME', 'your_username')
RACKSPACE_API_KEY = os.environ.get('RACKSPACE_API_KEY', 'your_api_key')
if RACKSPACE_USER == 'your_username' or RACKSPACE_API_KEY == 'your_api_key':
print("Please set RACKSPACE_USERNAME and RACKSPACE_API_KEY environment variables.")
exit(1)
# Obtain a reference to the Rackspace Compute driver
cls = get_driver(Provider.RACKSPACE)
driver = cls(RACKSPACE_USER, RACKSPACE_API_KEY, region='iad') # 'iad' for US-East (Virginia)
print("Connected to Rackspace Compute service.")
# List available sizes (flavors)
print("Available sizes:")
sizes = driver.list_sizes()
for size in sizes:
print(f" - {size.id}: {size.name} ({size.ram}MB RAM, {size.disk}GB Disk)")
# List available images
print("Available images:")
images = driver.list_images()
for image in images:
print(f" - {image.id}: {image.name}")
# Example: Select a size and image for node creation (adjust as needed)
# This is a placeholder and might require matching a specific image/size from your account/region
# For Rackspace, a common base image might be 'Ubuntu 18.04' or similar.
# For size, 'performance1-1' (1GB RAM) is common.
selected_size = next((s for s in sizes if s.id == 'performance1-1'), None)
selected_image = next((i for i in images if 'Ubuntu 18.04' in i.name), None)
if selected_size and selected_image:
print(f"Attempting to create node with size: {selected_size.name} and image: {selected_image.name}")
# Note: Creating a node usually incurs cost. This part is commented out.
# try:
# node = driver.create_node(name='libcloud-test-node', size=selected_size, image=selected_image)
# print(f"Node created: {node.name} (ID: {node.id}, State: {node.state})")
# except Exception as e:
# print(f"Error creating node: {e}")
else:
print("Could not find suitable size or image for node creation. Please check available options.")
Debug
Known issues
breakingLibcloud 3.9.0 (and newer) has significantly narrowed its Python version support. It now officially requires Python >= 3.10. Support for Python 3.9, 3.8, and 3.7 has been explicitly dropped in recent 3.x releases.fixEnsure your Python environment is running Python 3.10 or newer when using Libcloud 3.9.0+. For older Python versions, you must pin to an older Libcloud release (e.g., v3.8.x for Python 3.7/3.8, v3.9.x for Python 3.9).
affects: 3.x (specifically 3.5.0+, 3.7.0+, 3.9.0+)
breakingSeveral compute drivers for defunct or non-offering providers were removed in Libcloud 3.8.0. If you are upgrading from an older version and using one of these providers, your code will break.fixReview the Libcloud 3.8.0 changelog for a list of removed drivers. If your provider is affected, you will need to migrate to a supported provider or pin to an older Libcloud version that still includes the necessary driver.
affects: 3.8.0+
gotchaHardcoding API credentials directly in your code is a security risk. It's a common mistake that leads to credential exposure.fixAlways use environment variables, a secure configuration management system, or a dedicated secrets manager to handle sensitive API keys and usernames. Access them via `os.environ.get()` as shown in the quickstart example.
affects: All versions
gotchaIn older versions (prior to 0.4.2), Libcloud did not validate host SSL certificates by default, making applications vulnerable to Man-in-the-Middle attacks.fixUpgrade to Libcloud version 0.4.2 or higher. Additionally, ensure `libcloud.security.VERIFY_SSL_CERT` is set to `True` for secure connections, although this is the default in modern versions.
affects: < 0.4.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'libcloud.utils'
The 'libcloud.utils' module is missing, possibly due to an incomplete installation or missing dependencies.
fixEnsure that 'apache-libcloud' is correctly installed using pip: 'pip install apache-libcloud'.
ImportError: cannot import name 'ResponseError'
The 'ResponseError' class is not found, likely due to an outdated or incompatible version of the 'requests' library.
fixUpgrade the 'requests' library to the latest version using pip: 'pip install --upgrade requests'.
ImportError: cannot import name 'api'
The 'api' module cannot be imported, possibly due to a misnamed or missing package.
fixEnsure that the correct package is installed and properly named; for AWS CLI, install 'awscli' instead of 'aws': 'pip install awscli'.
ImportError: cannot import name 'docevents' from 'botocore.docs.bcdoc'
The 'docevents' module is missing, likely due to an outdated version of 'botocore'.
fixUpgrade 'botocore' to the latest version using pip: 'pip install --upgrade botocore'.
ImportError: cannot import name 'UnrewindableBodyError'
The 'UnrewindableBodyError' class is missing, possibly due to an outdated or incompatible version of the 'urllib3' library.
fixUpgrade the 'urllib3' library to the latest version using pip: 'pip install --upgrade urllib3'.
Upgrade
Version history
3.9.1latest on PyPI · released Apr 21, 2026
Audit
Dependencies
No dependency data recorded yet.