promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[BUG] [VSCode Extension] Not able to import modules outside of the flow directory

Open MingStar opened this issue 7 months ago • 9 comments

Describe the bug I have 2 flows in my project, both of them need to import project shared code (the project module is lib) outside the flow working directory.

When I do that, the VS code extension always failed to load the Python nodes, with this error message (ModuleNotFoundError) No module named 'lib'

Trying to set PYTHONPATH to the project workspace folder after clicking "Regenerate with advanced options" in the Python node does not seem to have effects.

This issue is similar to https://github.com/microsoft/promptflow/issues/3209

How To Reproduce the bug

  1. set up the project like this:
lib/
flow1/
flow2/
  1. create a Python node in one of the flows, which does from lib import ...

  2. execute the flow, the ModuleNotFoundError will appear.

Environment Information

  • Promptflow Package Version using pf -v: { "promptflow": "1.12.0", "promptflow-core": "1.12.0", "promptflow-devkit": "1.12.0", "promptflow-tracing": "1.12.0" }
  • Operating System: MacOS
  • Python Version: 3.11
  • Prompt Flow extension version: 1.20.0

MingStar avatar Jul 03 '24 01:07 MingStar