promptflow
promptflow copied to clipboard
[BUG] [VSCode Extension] Not able to import modules outside of the flow directory
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
- set up the project like this:
lib/
flow1/
flow2/
-
create a Python node in one of the flows, which does
from lib import ...
-
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