Good morning - we have a Azure Function App in development running a series of Python based functions.
Python - 3.7.7
[email protected]
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_
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....
It looks like I am not the only one facing this particular issue with the modules. From yesterday, the local debug doesn't work as usual with the same error.
Hi @zhenming91 - glad I'm not the only one, this was driving me crazy.
I did two more tests:
1) Created brand new Function App from Visual Code with simple HTTP trigger. Venv based on Python 3.7. Local Debug generated the same error.
2) Same as above with Python 3.8.3 venv - same error.
Obviously local debug is critical to ongoing development, please can you look at this asap?
Hi, I am also having the same issue.
My environment is the following;
The following is the error I am getting while debugging the function locally,
Exception has occurred: ModuleNotFoundError
No module named 'grpc_tools'
File "c:\users\{user}\appdata\roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.7\windows\x64\grpc\__init__.py", line 2034, in <module>
import grpc_tools
File "c:\users\{user}\appdata\roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.7\windows\x64\azure_functions_worker\dispatcher.py", line 16, in <module>
import grpc
File "c:\users\{user}\appdata\roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.7\windows\x64\azure_functions_worker\main.py", line 7, in <module>
from . import dispatcher
File "c:\users\{user}\appdata\roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.7\windows\x64\worker.py", line 59, in <module>
from azure_functions_worker import main
Can you look at this issue?
Experiencing the same issue with local debugging. Not sure but I was asked to update Visual Studio Code as wel today.
I was able to reproduce this as well. For the time being, you should be able to disable breaking on exceptions to avoid the debugger breaking on those errors.
@Hazhzeng do you know what might be happening here?
Just for the sake of empathy. I'm on the verge of going crazy as well! Having the exact same problem
Thanks for reporting - looks like there is a regression when debugging - we will be investigating this the first thing and will update this thread on our findings, workarounds and fixes.
Looking into it now.
Hi @JADawson, thanks for reporting the issue, this is caused by the vscode-python extension 2020.5.86398.
Thanks @Rutikhal for providing the following recovery steps.
To mitigate this issue, please consider:



We're still actively investigating this issue and finding the root cause.
Hi @Hazhzeng, @anirudhgarg ,
Thanks for posting the above workaround regarding the Python extension - I can confirm that this works in my environment and get around the issue.
Much obliged, we can now get on with our development.
I've downgraded to v2020.5.80290 as described above but am still getting the same import error - any updates?
@SamGinzburg we have multiple folks reporting that this solved it for them (we have also confirmed). Can you perhaps restart VSCode and confirm that you are using the older version.
@SamGinzburg we have multiple folks reporting that this solved it for them (we have also confirmed). Can you perhaps restart VSCode and confirm that you are using the older version.
Yes I have done so, I am 100% sure that I am using the older version
great @Hazhzeng ! Your solution saved my life here! Thanks!
Just upgraded to v2020.5.86806 and it fixed the problem. Timely.
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.
Interesting. I updated to v2020.5.86806 and debugging functions works again.
Thank you @Hazhzeng, @anirudhgarg for the fix, the debug works fine now.
Reverted to version 2020.5.80290 and debugging is working again. Will check v2020.5.86806 now.
It appears that v2020.5.86806 is working for me as well. Thanks for the support!
I checked v2020.5.86806 as well - still broken for me
VScode info:
Version: 1.46.0 (user setup)
Commit: a5d1cc28bb5da32ec67e86cc50f84c67cc690321
Date: 2020-06-10T09:03:20.462Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041
VSCode has just released the latest version (2020.5.86806) of Python Extension.
Please update the extension to the latest version and it will fix this issue.
Most helpful comment
Hi @JADawson, thanks for reporting the issue, this is caused by the vscode-python extension 2020.5.86398.
Thanks @Rutikhal for providing the following recovery steps.
To mitigate this issue, please consider:
We're still actively investigating this issue and finding the root cause.