skip to Main Content

I have a Python Function App created with Consumption Plan. I am trying to deploy an app that makes use tensorflow using the VS Code Function App extension. But the Deploy to Function App fails on just adding tensorflow to requirements.txt. I get the following error:

collecting tensorflow
6:04:44 am PostComparisonApp: [00:34:44+0000]   Downloading tensorflow-2.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (578.1 MB)
6:05:10 am PostComparisonApp: Done in 27 sec(s).
6:05:14 am PostComparisonApp: /opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9.7 -p packagedir=.python_packages/lib/site-packages
6:05:14 am PostComparisonApp: Generating summary of Oryx build
6:05:14 am PostComparisonApp: Deployment Log file does not exist in /tmp/oryx-build.log
6:05:14 am PostComparisonApp: The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
6:05:14 am PostComparisonApp: Deployment Failed. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
6:05:26 am PostComparisonApp: Deployment failed.

I get this error on no other change to the templace function that is provided on creating function in the extension.
I have also tried running the func azure functionapp publish command as well, but get the same error. I have tried deleting the App and creating new one, but still same error.

2

Answers


    • This is the way I was able to deploy tensor flow with the azure function.

    • First inside the folder I create a virtual environment using command

    python -m venev test
    
    • Then I installed tensorflow using
    pip isntall tensorflow
    
    • Now I created the function inside the folder and added tensorflow to requirment.txt.

    • the function just return the version of the tensorflow

    function code :

    import  logging
    import tensorflow as  tf
    import azure.functions as  func
    
    def  main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    name = tf.__version__
    return  func.HttpResponse(name)
    
    • Then I just deployed the function to azure

    enter image description here

    enter image description here

    Login or Signup to reply.
  1. After trying lots of different things, I found that if you use tensorflow-cpu instead of tensorflow in requirements.txt, it deploys just fine.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search