Issue while running Azure Functions Locally

Contributor

Hi All,

 

Launch.json

 

{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}
 
Settings.json
{
"python.linting.pylintEnabled": false,
"python.linting.pep8Enabled": true,
"python.linting.enabled": true,
"python.pythonPath": "C:\\Users\\C21055\\AppData\\Local\\Programs\\Python\\Python38\\python.exe",
"azureFunctions.deploySubpath": ".",
"azureFunctions.scmDoBuildDuringDeployment": true,
"azureFunctions.pythonVenv": ".venv38",
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~2",
"terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe"
}
 
tasks.json

 

{
"version": "2.0.0",
"tasks": [
{
"label": "runFunctionsHost",
"type": "shell",
"osx": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func extensions install && pip install -r requirements.txt && func host start"
},
"windows": {
"command": ". ${config:azureFunctions.pythonVenv}/Scripts/activate ; func extensions install ; pip install -r requirements.txt ; func host start"
},
"linux": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func extensions install && pip install -r requirements.txt && func host start"
},
"isBackground": true,
"options": {
"env": {
"languageWorkers__python__arguments": "-m ptvsd --host 127.0.0.1 --port 9091"
}
},
"problemMatcher": "$func-watch"
},
{
"label": "funcPack",
"type": "shell",
"osx": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func pack"
},
"windows": {
"command": ". ${config:azureFunctions.pythonVenv}/Scripts/activate ; func pack"
},
"linux": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func pack"
},
"isBackground": true
}
]
}

 

I am trying to run Azure Functions locally in my machine but getting below error while running it

 

Sagar_Lad_0-1610265550130.png

Sagar_Lad_1-1610265576735.png

 

1 Reply

@Sagar_Lad 

 

you can install the python dependencies first.

install azure-functions and try again