profile
viewpoint

Ask questionsLocal Debug for Azure Functions failing due to missing libraries

Good morning - we have a Azure Function App in development running a series of Python based functions.

Python - 3.7.7 azure-functions-core-tools@3.0.2534

Until yesterday, this was running fine both in local debug (Attach to Python Functions) and when deployed to the function app in Azure.

As of yesterday (20200609) it started hitting a series of missing imports within the azure-functions-core-tools module - azure-functions-core-tools\bin\workers\python\3.7\windows\x64\grpc_init.py_

  • import grpc_tools
  • import grpc_health
  • import grpc_reflection

I added the following to requirements.txt

** grpcio==1.29.0 grpcio-tools==1.29.0 grpcio-health-checking==1.29.0**

Which allowed the execution to progress, but now it's hitting an issue with "google.protobuf" in azure-functions-core-tools\bin\workers\python\3.7\windows\x64\google\protobuf\internal\api_implementation.py

from google.protobuf import enable_deterministic_proto_serialization

Exception has occurred: ImportError cannot import name 'enable_deterministic_proto_serialization' from 'google.protobuf' (xxx\venv\lib\site-packages\google\protobuf_init_.py)

I'm really confused as this has been running locally just fine for weeks.

I've tried re-installing the azure-functions-core-tools, but that hasn't helped. I don't think adding more library imports to my venv is the right solution, it seems there is some bug in the azure-functions-core-tools package....

Azure/azure-functions-core-tools

Answer questions luabud

This doesn't seem to be an issue in the Python extension, this can also be reproduced with other extensions such as CMake Tools and Docker. We're tracking the issue upstream in the VS Code repo here: microsoft/vscode#99699.

FWIW I can still reproduce the same issue when manually installing previous versions of the Python extension, so I'm not sure what is going on.

useful!

Related questions

ImportError: cannot import name 'cygrpc' - when using 32-bit python hot 2
ImportError: cannot import name 'cygrpc' - when using 32-bit python hot 2
ImportError: cannot import name 'cygrpc' hot 1
Cannot access a disposed object. Object name: 'IServiceProvider' on Linux hot 1
func settings add FUNCTIONS_WORKER_RUNTIME results in base64 value in local.settings.json hot 1
Cannot install azure-functions-core-tools@core behind proxy hot 1
Developing functions locally using bindings pointing to the Cosmos Emulator hot 1
Default tasks.json does not work with nested folder structure hot 1
better error message if the CLI sees nested values in local.settings.json hot 1
Publishing App sometimes results in 400 error hot 1
Fails to run on docker image hot 1
CLI host shutdown when function timeout occured hot 1
func settings add FUNCTIONS_WORKER_RUNTIME results in base64 value in local.settings.json hot 1
Linux: Unable to access <app>.scm.azurewebsites.net, Service Unavailable hot 1
Error calling sync triggers (BadRequest). Python runtime on Linux hot 1
Github User Rank List