Skip to content

F5 debugging ignores newly created .venv and fails to load openai #5182

Open

Description

@v-ruizh

OS: Win 11 x64
Build Version: 20260910.1
Regression: Not a Regression

Repro Steps:

  1. Create a project using the LangChain with OpenAI (Python + AZD + Bicep) template from Azure Functions Template Gallery.
  2. After project creation, Azure Functions shows: Failed to find Python virtual environment ".venv".
  3. Click "Create virtual environment".
  4. Wait for dependency installation to complete.
  5. Press F5 to start debugging.

Expect:
F5 debugging should use the virtual environment created from the Azure Functions notification and successfully resolve dependencies installed in .venv.

Actual:
Debugging fails with error ModuleNotFoundError: No module named 'openai'.
Although the virtual environment is created and dependency installation reports completion, the debugger appears not to use the newly created .venv, causing required packages to be unavailable at runtime.

* Executing task: .venv\Scripts\python -m pip install -r requirements.txt
Requirement already satisfied: openai in
C:\Users\v-ruizh\Desktop\99\pylangchain\.venv\Lib\site-packages
...
[Error]
ModuleNotFoundError: No module named 'openai'
Additional observation:
Current sys.path contains:
C:\Users\v-ruizh\AppData\Local\Programs\Python\Python312\Lib\site-packages
but does not contain:
C:\Users\v-ruizh\Desktop\99\pylangchain\.venv\Lib\site-packages

More Info:
The issue was transient. After re-running the dependency installation command and retrying debugging later, the project started successfully without further changes. However, the initial F5 session consistently failed with ModuleNotFoundError: No module named 'openai'.

Activity

  1. v-ruizh commented on Sep 21, 2026

    @v-ruizh
    Author

    I can reproduce a very similar issue with the Durable Functions Order Processing template.
    The project is created successfully and the generated .venv is present under the project folder.
    F5 debugging fails with: ModuleNotFoundError: No module named 'azure.durable_functions'

    However, the package is available in the generated virtual environment:
    ..venv\Scripts\python.exe -c "import azure.durable_functions as df"
    This command succeeds without error.
    The project also runs successfully when started manually: func start
    All functions are discovered and indexed correctly.
    This suggests the dependency itself is installed correctly and the issue only occurs during F5 debugging. It looks very similar to the behavior described in this issue, where the debugger may not be using the generated .venv.

  2. manvkaur commented on Oct 1, 2026

    @manvkaur
    Contributor

    The LangChain sample repository is archived and is removed from Template Gallery. This applies to the archived LangChain sample; the Durable Functions Order Processing reproduction reported above remains unresolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions