Skip to content

Debugging Python Functions ignores Selected interpreter and python.pythonPath #3477

Open

Description

Hi there,

It seems like by default, the azure functions extension completely ignores the selected python path, and instead just uses python in the default path. I troubleshot this issue for days and learned way more about debugging than I ever wanted to to get it working.

Basically, the workaround is as follows:
My tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"label": "func: host start",
			"command": "conda activate AzureFunctions ; func host start --language-worker -- '-m ptvsd --host 127.0.0.1 --port 9091'",
			"problemMatcher": "$func-python-watch",
			"isBackground": true
		}
	]
}

I understand that you may not want to support conda out of the box, but it would be nice if it would respect the Selected Interpreter when testing.

After finding a solution I looked for similar issues and this issue and solution have been closed multiple times:
#2750
#3263
#3332 - Sort of?

Repro Steps

  1. Install Anaconda
  2. Create virtual environment using the following command in an anaconda prompt: conda create -n AzureFunctions python=3.9.7
  3. Activate Environment: conda activate AzureFunctions
  4. Install debugger: conda install ptsvd
  5. Install Azure-functions: pip install azure-functions
  6. Navigate to ~/Anaconda3/envs
  7. Set python.pythonPath=%userprofile%\Anaconda3\envs\AzureFunctions
  8. Create function project.
  9. Hit F5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions