Azure Core Library for Python

raw JSON →
1.39.0 verified Tue May 12 auth: no python install: stale quickstart: stale

The Azure Core Library for Python provides essential functionalities for Azure SDK clients, including authentication, logging, and HTTP transport. Current version: 1.39.0. Release cadence: Regular updates with new features and fixes.

pip install azure-core
error ModuleNotFoundError: No module named 'azure.core'
cause The 'azure-core' package is not installed in the Python environment.
fix
Install the package using 'pip install azure-core'.
error ImportError: You need to install 'azure-core' to use this feature
cause The 'azure-core' package is missing, which is required by the Azure SDK.
fix
Ensure 'azure-core' is installed by running 'pip install azure-core'.
error ImportError: cannot import name 'VirtualMachinesOperations' from partially initialized module 'azure.mgmt.compute.v2022_03_01.operations'
cause A circular import issue occurs when directly importing operation classes from the Azure SDK.
fix
Use the client interface provided by the SDK instead of importing operation classes directly.
error ImportError: DLL load failed while importing _rust: The specified procedure could not be found.
cause A version compatibility issue exists between the 'azure-identity' package and the Python environment.
fix
Update the 'azure-identity' package to the latest version using 'pip install --upgrade azure-identity'.
error ImportError: cannot import name 'AccessTokenInfo' from 'azure.core.credentials'
cause The `AccessTokenInfo` class was introduced in a newer version (e.g., 1.33.0) of `azure-core`, and your installed version is older, or there's a dependency conflict where an older version is being used.
fix
Upgrade the azure-core library to the latest version, or a version that includes AccessTokenInfo: pip install --upgrade azure-core azure-identity (if using azure-identity which often relies on it).
breaking The 'azure' meta-package is deprecated as of version 5.0.0 and can no longer be installed. Install individual packages as needed.
fix Install specific Azure SDK packages like 'azure-core' directly.
deprecated The 'azure' meta-package is deprecated as of version 5.0.0 and can no longer be installed. Install individual packages as needed.
fix Install specific Azure SDK packages like 'azure-core' directly.
gotcha Attempting to 'await' an asynchronous operation (e.g., from an Azure SDK transport client) outside of an 'async def' function will result in a 'SyntaxError: 'await' outside function'. This typically happens when using async client methods without defining the caller function as asynchronous.
fix Ensure that any function containing 'await' expressions is declared with 'async def'. For top-level script execution, wrap the async call in an async function and use `asyncio.run()`.
breaking Using 'await' outside of an 'async def' function context will raise a SyntaxError. Top-level 'await' is not directly supported in standard Python scripts prior to Python 3.11 for modules, or Python 3.7 for REPL.
fix Ensure all 'await' expressions are placed inside a function defined with 'async def'. If using 'await' at the top level, ensure your Python version and execution environment supports it (e.g., Python 3.11+ module, IPython/Jupyter, or a custom event loop runner).
python os / libc status wheel install import disk
3.10 alpine (musl) - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) - - - -
3.13 slim (glibc) - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) - - - -

Basic usage of HttpRequest from azure-core

from azure.core.pipeline import HttpRequest

# Create an HttpRequest object
request = HttpRequest('GET', 'https://example.com')

# Send the request (assuming a transport is set up)
response = await transport.send(request)

print(response.status_code)