Azure Functions Python virtual environment not recognized in VS Code for debugging

ddx1 171 Reputation points
2021-02-12T00:26:32.377+00:00

My colleague is unable to debug in VS Code using a Python Azure Function our organization uses. When cloning the repository for the function, she is prompted to create a virtual environment, but no Python version is found under this prompt:
Select a Python interpreter to create a virtual environment

She has tried both manually entering her Python interpreter full path and creating a virtual environment manually in the integrated terminal, but the function will not start when debugging. However, the function does start using func start in the terminal. We have followed all the steps here and ensured all the required packages are installed: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python

When I try to reproduce the issue, I'm also prompted to create a virtual environment, but my interpreter shows up and the environment is successfully created. I am using Python 3.7.9 and my colleague is using 3.8.3. We're both using Anaconda versions of Python.

We have also attempted to manually run:
python -m venv .venv
.venv\Scripts\activate && pip install -r requirements.txt

in the terminal, but we are seeing this error when we attempt to debug:

> Executing task: .venv\Scripts\python -m pip install -r requirements.txt <
activate does not accept more than one argument:
['C:\\Users\\ddx\\anaconda3', '/d', '/c', '.venv\\Scripts\\python', '-m', 'pip', 'install', '-r', 'requirements.txt']

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
3,695 questions
0 comments No comments
{count} votes

Accepted answer
  1. ddx1 171 Reputation points
    2021-02-12T20:41:28.12+00:00

    We have found a workaround to get debugging work. The activate does not accept more than one argument error happens in tasks.json on the pipInstall requirement. After removing that requirement, we were able to get the function to debug.

    0 comments No comments

0 additional answers

Sort by: Most helpful