Closed pievalentin closed 2 years ago
We face the same problem with another package (nest-asyncio). Have a look here: https://docs.microsoft.com/en-us/answers/questions/976311/modulenotfounderror-on-external-packages.html Sadly the proposed solution there made things worse for us. The function did not even start up
@pievalentin I have tried deploying the function through VSCode to dedicated app and tested basic function with utilizing NumPy and it is working as expected. 1) Are you still facing this issue? 2) If yes, could you please provide more details for reproducing issue?
Thanks
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
@pdthummar I found a fix for my issue.
In the azure-pipelines.yaml
building my Azure function zip, I now run this command:
pip install --only-binary=:all: --target="./.python_packages/lib/site-packages" -r ./requirements.txt
Specifically asking for --only-binary=:all:
This solved my issue of missing binaries once the function is running
@martin-greentrax It's been a while but maybe my solution will help you
@pievalentin Thank you for your solution. Back then we found this proposed workaround on-line and we have not seen the issue afterwards. Adding this to the main entry point file of our function:
sys.path.append("/home/site/wwwroot/.python_packages/lib/site-packages")
sys.path.append("/home/site/wwwroot")
sys.path.append("/tmp/functions/standby/wwwroot")
Last week we were notified by Microsoft support staff that this work around would no longer be necessary. Since this issue only occurred occasionally, was not able to be triggered by artificial traffic and affected our production systems we are a bit hesitant to experiment though. :)
Similar to #1116. Will post updates in there.
Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
Set numpy as a dependecy in the
requirements.txt
Have the python function import numpy likeimport numpy as np
This is very similar to this issue but using the ubuntu vm as a builder didn't solve the issueExpected behavior
To be able to import Numpy
Actual behavior
Fail to import numpy. This is the output of my durable function.
Known workarounds
reinstall numpy on the host. Pip should make sure the c libraries are presents. Thing is I don't have access to the host as its serverless
Related information
Provide any related information
Programming language used : Python
Source: I am using this async example but with numpy as a depedency for math processing.
Source
This fails on this code:In other word is there any workaround to make sure that the binary necessary for numpy are present on the host?