I fix the problem following this thread: https://stackoverflow.com/questions/74706756/azure-function-importerror-functionregister-when-runnning-on-cloud
Azure Function ImportError when runnning on cloud
Hi all,
I am facing issue with azure function deployment as the azure functions returns the below error:
Result: Failure Exception: ImportError: cannot import name 'FunctionRegister' from 'azure.functions' (/azure-functions-host/workers/python/3.7/LINUX/X64/azure/functions/init.py). Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py", line 318, in _handle__function_load_request func_request.metadata.entry_point) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 42, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 40, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/loader.py", line 85, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/site/wwwroot/ClientStarter/init.py", line 5, in <module> import azure.durable_functions as df File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/durable_functions/init.py", line 14, in <module> from .decorators import DFApp File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/durable_functions/decorators/init.py", line 4, in <module> from .durable_app import DFApp File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/durable_functions/decorators/durable_app.py", line 10, in <module> from azure.functions import FunctionRegister, TriggerApi, BindingApi, AuthLevel
From my local machine this not happens and by the way never happened before. I'm using pyhton 3.7 and function apps running on versions 3.x and I have noticed that :
Beginning on December 3, 2022, function apps running on versions 2.x and 3.x of the Azure Functions runtime can no longer be supported. Before that time, please test, verify, and migrate your function apps to version 4.x of the Functions runtime. For more information, see Migrate apps from Azure Functions version 3.x to version 4.x. After the deadline, function apps can be created and deployed, and existing apps continue to run. However, your apps won't be eligible for new features, security patches, performance optimizations, and support until you upgrade them to version 4.x.
I cannot upgrade to version 4.x, so there is a way to still use 3.x and avoid the error?