Azure-functions-core-tools: Exceptions when debugging a python function app in a vscode workspace's subfolder

Created on 18 Dec 2019  路  9Comments  路  Source: Azure/azure-functions-core-tools

Hello,

The issue happened when upgrading azure-functions-core-tools to 2.7.1948

To start/debug my python azure function, I allways used the following task:

      {
        "type": "func",
        "command": "host start",
        "problemMatcher": "$func-watch",
        "isBackground": true,
        "dependsOn": [ "pipInstall" ],
        "options": {
          "cwd": "${workspaceFolder}/AlarmScoringFuncApp"
        }
      },

The AlarmScoringFuncApp folder contains host.json the python modules of my functions.

${workspaceFolder} contains some other related projects, and it is the root of the GIT repository.

Here is the detail of the exception:

No module named 'grpc_tools'
  File "c:\users\abreneli\appdata\roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.7\windows\x64\grpc\__init__.py", line 1851, in <module>
    import grpc_tools
  File "c:\users\abreneli\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\abreneli\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\abreneli\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

From the terminal, if I do

cd AlarmScoringFuncApp
func start

then the application is started successfully.

If open Visual Studio code from the AlarmScoringFuncApp folder I can launch and debug the function app successfully.

investigate

All 9 comments

@Anthony-Breneliere Did you find a fix?

@Anthony-Breneliere Did you find a fix?

I did not try to find a fix, as it is internal to azure function hosting. I just bypassed exceptions when I start debugging the app.

@rchesak is your app in a subfolder and using Core Tools 2.x as well?

@Hazhzeng do you know what might be happening here?

@rchesak is your app in a subfolder and using Core Tools 2.x as well?

@anthonychu Yes and yes

Any news for that?

Any updates on this? it was working fine for me, i was able to debug python azure functions from vs code. once i added few packages related to key vault i guess after that started getting this issue despite removing vault references. I have uninstalled vscode, python, core tools for functions and re-installed, Still getting the error.

_Exception has occurred: ModuleNotFoundError
No module named 'grpc_health'
File "c:\users\userappdata\roamingnpm\node_modules\azure-functions-core-tools\bin\workers\python\3.7\windows\x64\grpc__init__.py", line 2039, in _

Hi @bharangit, this is an issue introduced by the latest version VSCode Python extension. A workaround can be found here.

Hi @bharangit, this is an issue introduced by the latest version VSCode Python extension. A workaround can be found here.

Thanks a lot @Hazhzeng. it works now!!

Hi @Hazhzeng I'm having the same error : Exception has occurred: ModuleNotFoundError No module named 'grpc_tools' and it wouldn't recognize packages like pandas ..

This used to work fine for me two or 3 weeks ago. I'm not sure if it's because of the python extension as mentioned above (I am on the latest one now 2020.11.3637..) but even downgrading to earlier versions did not solve the problem.

My python version of the interpreter is 3.7.2 64bits.

Any updates on this please ?

Was this page helpful?
0 / 5 - 0 ratings