Curts0 / PyTabular

Connect to Tabular Models via Python
https://curts0.github.io/PyTabular/
MIT License
67 stars 11 forks source link

import error in Azure Functions #92

Open sangee14 opened 1 year ago

sangee14 commented 1 year ago

I am using python-tabular to refresh partitions in SSAS model through python script. While deploying the code in Azure Functions, I tried to trigger the azure functions, getting the import error in the import statement of this particular library.

Azure Function: Operating System : Linux Runtime version: 4.25.2.2 Language used : Python Python version: 3.10

Full Exception :
 Exception while executing function
 /Functions.httpTrigger ---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException 
 /Result
 /Failure Exception
 /RuntimeError
 /Could not find libmono 

 /  
 '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 380, in _handle__function_load_request     func = loader.load_function(   
 '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 44, in call     return func(*args, **kwargs)   
 '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py', line 132, in load_function     mod = importlib.import_module(fullmodname)   
 '/usr/local/lib/python3.10/importlib/__init__.py', line 126, in import_module     return _bootstrap._gcd_import(name[level:], package, level)   
 '<frozen importlib._bootstrap>', line 1050, in _gcd_import   
 '<frozen importlib._bootstrap>', line 1027, in _find_and_load   
 '<frozen importlib._bootstrap>', line 1006, in _find_and_load_unlocked   
 '<frozen importlib._bootstrap>', line 688, in _load_unlocked   
 '<frozen importlib._bootstrap_external>', line 883, in exec_module   
 '<frozen importlib._bootstrap>', line 241, in _call_with_frames_removed   
 '/home/site/wwwroot/httpTrigger/__init__.py', line 9, in <module>     from .refresh_automation import main_func   
 '/home/site/wwwroot/httpTrigger/refresh_automation.py', line 6, in <module>     import pytabular   
 '/home/site/wwwroot/.python_packages/lib/site-packages/pytabular/__init__.py', line 45, in <module>     import clr   
 '/home/site/wwwroot/.python_packages/lib/site-packages/clr.py', line 6, in <module>     load()   
 '/home/site/wwwroot/.python_packages/lib/site-packages/pythonnet/__init__.py', line 36, in load     set_default_runtime()   
 '/home/site/wwwroot/.python_packages/lib/site-packages/pythonnet/__init__.py', line 22, in set_default_runtime     set_runtime(clr_loader.get_mono())   
 '/home/site/wwwroot/.python_packages/lib/site-packages/clr_loader/__init__.py', line 21, in get_mono     libmono = find_libmono(sgen)   
 '/home/site/wwwroot/.python_packages/lib/site-packages/clr_loader/util/find.py', line 67, in find_libmono     raise RuntimeError('Could not find libmono')     
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters,FunctionInvocationContext context) 
/src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs 
 /101    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) 
/src/azure-functions-host/src/WebJobs.Script/Description/FunctionInvokerBase.cs 
 /82    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.Coerce[T](Task`1 src) 
/src/azure-functions-host/src/WebJobs.Script/Description/FunctionGenerator.cs 
 /225    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments) 
D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs 
 /52    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance) 
D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs 
 /581    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance,ParameterHelper parameterHelper,ILogger logger,CancellationTokenSource functionCancellationTokenSource) 
D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs 
 /527    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,ParameterHelper parameterHelper,ILogger logger,CancellationToken cancellationToken) 
D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs 
 /306    End of inner exception    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,ParameterHelper parameterHelper,ILogger logger,CancellationToken cancellationToken) 
D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs 
 /352    
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    
async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken) 
D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs 
 /108