0

When running one of my functions which includes pandas, I get the following error message:

Result: Failure Exception: ImportError: Unable to import required dependencies: numpy: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "/usr/local/bin/python" * The NumPy version is: "1.23.4" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: libopenblas64_p-r0-742d56dc.3.20.so: cannot open shared object file: No such file or directory . Please check the requirements.txt file for the missing module. For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 365, in _handle__function_load_request func = loader.load_function( File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 48, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 44, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/loader.py", line 134, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/site/wwwroot/PROD_Avg_Tot_Debits_And_Account_Balance/__init__.py", line 6, in <module> import pandas as pd File "/home/site/wwwroot/.python_packages/lib/site-packages/pandas/__init__.py", line 16, in <module> raise ImportError(

I have reinstalled pandas and numpy, I have force updated them both. I have tried reverting to an older version of numpy (1.21.0). What is my next step in debugging this issue?

Wragnam
  • 19
  • 2
  • Uninstall the numpy and setuptools first using this [SO Answer](https://stackoverflow.com/a/59346525) and let me know if it works. –  Nov 19 '22 at 13:49
  • Just tried it now, but still gives me the same error – Wragnam Nov 20 '22 at 09:26
  • Could you provide the details like Azure Functions Python Version you have used. –  Nov 20 '22 at 12:05
  • I'm using python3.9, and the numpy version is 1.23.4, but I have also tried numpy version 1.20.0. I also don't know if this has something to do with it "Original error was: libopenblas64_p-r0-742d56dc.3.20.so: cannot open shared object file: No such file or directory" – Wragnam Nov 21 '22 at 06:12

1 Answers1

0

I have created the Azure Functions Python Version 3.9.13 with the below packages Pandas and NumPy as 1.5.1 and 1.23.5:

enter image description here

Written the sample code that uses pandas and NumPy packages and it is working as expected:

import  logging
import  pandas  as  pd
import  numpy  as  np  
import  azure.functions  as  func

def  main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')

S = pd.Series([11, 28, 72, 3, 5, 8])
arr = np.array( [[ 1, 2, 3],
[ 4, 2, 5]] )

print(S.values)
print("Size of numpy array: ", arr.size)

return  func.HttpResponse(
"Hello Krishna, This HTTP triggered function executed successfully.",
status_code=200
)

enter image description here