Registry / azure / azureml-fsspec

azureml-fsspec

JSON →
library1.3.1pypypiunverified

The `azureml-fsspec` library enables the `fsspec` (Filesystem Spec) library to interact with Azure Machine Learning datastores. It registers 'azureml://' and 'adl://' protocols, allowing users to access, read, and write files within Azure ML datastores using the familiar `fsspec` API. The current version is 1.3.1, and it's released as part of the broader Azure ML SDK ecosystem, typically following its release cadence.

pip install azureml-fsspec
INSTALL
IMPORT
SIG · AZUREML-FSSPEC
A
azureml-fsspec
azurepythonv1.3.1
Install
6.3s avg
Import
Disk
130MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.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
musl
glibc
py 3.10
✕ build_error
✓ 6.23s
py 3.11
✕ build_error
✓ 6.18s
py 3.12
✕ build_error
✓ 5.5s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 7.13s
130MB installed
● package 130MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AzureMLFileSystem
from azureml.fsspec import AzureMLFileSystem
from azureml.fsspec import AzureMLFileSystem

This quickstart demonstrates how to import `azureml-fsspec` to register its protocols with `fsspec` and how to obtain an `AzureMLFileSystem` instance. It highlights the need for Azure ML workspace details (subscription ID, resource group, workspace name, datastore name), typically provided via environment variables. Actual I/O operations (like listing files) are commented out, as they require a live Azure ML setup with valid credentials and permissions to succeed without errors.

import fsspec import azureml.fsspec # This import registers the "azureml" and "adl" protocols import os print("azureml-fsspec imported, protocols registered.") # Environment variables for AzureML workspace details. # In a real scenario, these must be set or passed via the fsspec.filesystem() call or URI query params. subscription_id = os.environ.get("AZUREML_SUBSCRIPTION_ID", "") resource_group = os.environ.get("AZUREML_RESOURCE_GROUP", "") workspace_name = os.environ.get("AZUREML_WORKSPACE_NAME", "") datastore_name = os.environ.get("AZUREML_DATASTORE_NAME", "workspaceblobstore") # Common default datastore name if all([subscription_id, resource_group, workspace_name]): print(f"\nAttempting to get AzureML filesystem instance for datastore: {datastore_name}...") try: # Get a filesystem instance using specific workspace details and datastore. # This approach explicitly provides connection details. fs = fsspec.filesystem("azureml", subscription_id=subscription_id, resource_group=resource_group, workspace_name=workspace_name, datastore_name=datastore_name) print(f"Successfully initialized AzureML filesystem object: {type(fs)}") # Example: Try to list the root of the specified datastore. # This will only succeed with valid credentials and permissions. # path_to_list = f"azureml://datastores/{datastore_name}/paths/" # print(f"Attempting to list contents of: {path_to_list}") # contents = fs.ls("/") # Listing root of the specific datastore instance # print(f"First 5 items from {datastore_name} root: {contents[:5]}...") # print(f"Total items found: {len(contents)}") except Exception as e: print(f"Could not initialize AzureML filesystem (this is common without a full setup): {e}") print("Please ensure AZUREML_SUBSCRIPTION_ID, AZUREML_RESOURCE_GROUP, AZUREML_WORKSPACE_NAME, and AZUREML_DATASTORE_NAME are correctly set as environment variables or passed as arguments.") else: print("\nSkipping AzureML filesystem initialization and IO: AzureML environment variables not fully set.") print("Set AZUREML_SUBSCRIPTION_ID, AZUREML_RESOURCE_GROUP, AZUREML_WORKSPACE_NAME, and AZUREML_DATASTORE_NAME for a live example.") print("\nDemonstrating direct import of AzureMLFileSystem class:") from azureml.fsspec import AzureMLFileSystem print(f"AzureMLFileSystem class found: {AzureMLFileSystem}")
Debug
Known issues
gotchaAzureML authentication is required and can be complex. This library relies on the underlying AzureML SDK's authentication mechanisms, which can include environment variables (e.g., AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID), Azure CLI login, or managed identity.
fix
Ensure your environment is correctly authenticated with Azure. Use `az login` for Azure CLI, or set appropriate environment variables for service principal or managed identity authentication before running your Python code.
affects: >=1.0.0
gotchaForgetting to import `azureml.fsspec` will prevent the 'azureml' and 'adl' protocols from being registered with `fsspec`, leading to 'No such protocol' errors.
fix
Always include `import azureml.fsspec` at the beginning of your script when intending to use `fsspec` with Azure ML datastores. This import performs the necessary protocol registration.
affects: >=1.0.0
gotchaIncorrect or incomplete Azure ML URI format can lead to errors. The `azureml://` protocol expects specific parameters (subscription ID, resource group, workspace name, datastore name, and path). These can be in the URI itself or passed as keyword arguments to `fsspec.filesystem()`.
fix
Ensure your URI follows the pattern `azureml://datastores/<datastore_name>/paths/<path_to_file>` and that workspace details are provided either in the URI (as query parameters), as `fsspec.filesystem` arguments, or via environment variables. `adl://` is specific to ADLS Gen2 datastores.
affects: >=1.0.0
gotchaRequires specific minimum versions of `fsspec` and `azureml-core`. Older versions of these dependencies might not provide the necessary APIs or features.
fix
Check `pip list` and ensure `fsspec>=2023.10.0` and `azureml-core~=1.51.0` (or compatible versions) are installed. Upgrade with `pip install --upgrade fsspec azureml-core` if needed.
affects: <1.3.0
Upgrade
Version history
1.3.1latest on PyPI · released Feb 8, 2024
Audit
Dependencies
fsspecrequiredCore dependency for filesystem abstraction, requires version >=2023.10.0.
azureml-corerequiredUnderlying Azure Machine Learning SDK for datastore authentication and management, requires version ~=1.51.0.
msalrequiredMicrosoft Authentication Library for Python, used for Azure AD authentication, requires >=1.20.0,<2.0.0.
Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources