[BUG] azure-storage-blob incompatible with Python Functions 3.8
See original GitHub issueInvestigative information
- Timestamp: May 14 2020 - 8:40:01 PM PST
- Function App name: jpwircur7u6mu
- Exception type Microsoft.Azure.WebJobs.Host.FunctionInvocationException
- HostInstanceId: d09b7b97-db9e-45c0-857c-2104a0d12a68
- InvocationId 03abef06-46c7-4243-80f6-36185725f329
Repro steps
- Create a function using Python 3.8
- Add the import: “from azure.storage.blob import BlobSasPermissions, generate_blob_sas”
- Reference any of the storage functions
Similar issue was created here but closed. https://github.com/Azure/azure-sdk-for-python/issues/3623
Expected behavior
There should be no exception
Actual behavior
Will receive the following exception when running the function.
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.MyFunctionName
---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Result: Failure
Exception: ModuleNotFoundError: No module named 'azure.storage'
Stack: File "/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker/dispatcher.py", line 242, in _handle__function_load_request
func_request.metadata.entry_point)
File "/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker/loader.py", line 66, in load_function
mod = importlib.import_module(fullmodname)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/site/wwwroot/MyFunctionName/__init__.py", line 1, in <module>
from azure.storage.blob import BlobSasPermissions, generate_blob_sas
Contents of the requirements.txt file:
--find-links wheelhouse
azure-storage-blob==12.3.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Azure Function Python Module compatibility issue
functions as func would get detected but from azure.storage.blob import BlobClient remain unrecognized and will show the error as Import "azure.
Read more >Troubleshoot Python errors in Azure Functions - Microsoft Learn
This error occurs when a Python function app fails to load a Python ... The package is incompatible with the Python interpreter version ......
Read more >azure-storage-blob - PyPI
The Azure Storage Blobs client library for Python allows you to interact with three types of resources: the storage account itself, blob storage...
Read more >Using importlib.metadata — Python 3.11.1 documentation
New in version 3.8. Changed in version 3.10: importlib.metadata is no longer provisional. ... importlib_metadata is a library that provides access to the...
Read more >Databricks Runtime 8.3 for ML (Unsupported)
In this section: Top-tier libraries. Python libraries. R libraries. Java and Scala libraries (Scala 2.12 cluster) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @JackStromberg,
To mitigate this issue, could you use
func pack
to resolve the dependencies on your local machine? This will generate a .zip file which contains .python_packages in it. Upload this zip file into storage account and use its SAS URL in WEBSITE_RUN_FROM_PACKAGE app setting should work.@JackStromberg Could you confirm the following:
func start
, what version of python does it call out?python –version
, what does it show?The issue could be the modules version mismatch due to an update, which could be resolved by recreating python virtual environments.
Else, @Hazhzeng wrote a comprehensive list of diagnoses and mitigations in - Module not found issues Wiki, please let me know if that helps.