Skip to content

conda environment support when debugging #3263

Closed

Description

Hello!

I have an Azure Function in Python using a conda environment.
Unfortunately, the environment doesn't get activated when running the run/debug task. I've tried adding the activation to the run task, but in that way the debugger doesn't attach to the process:

image

My `launch.json`:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Python Functions",
            "type": "python",
            "request": "attach",
            "port": 9091,
            "preLaunchTask": "run"
        }
    ]
}
My `tasks.json`:
{
	"version": "2.0.0",
	"tasks": [
		{
			"label": "run",
			"type": "shell",
			"command": "conda activate ifcconverter && func host start",
			"problemMatcher": "$func-python-watch",
			"isBackground": true
		}
	]
}
My `settings.json`:
{
    "azureFunctions.deploySubpath": ".",
    "azureFunctions.scmDoBuildDuringDeployment": true,
    // "azureFunctions.pythonVenv": ".venv",
    "azureFunctions.createPythonVenv": false,
    "azureFunctions.projectLanguage": "Python",
    "azureFunctions.projectRuntime": "~4",
    "debug.internalConsoleOptions": "neverOpen"
}

When using the venv the venv gets activated automatically on run (I guess this is from the azureFunctions.pythonVenv setting.

  1. How can I get the environment to activate on run automatically?
  2. Why doesn't the debugger attach to the running process? The run task starts fine, it's the debugger that cannot connect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions