Prompt Flow Extension in VS Code Not Recognizing Libraries Installed in Virtual Environment

428 Views Asked by At

I'm currently learning how to use Prompt Flow in Azure AI Studio and have encountered an issue with the Prompt Flow extension in Visual Studio Code. I've set up a virtual environment using venv and activated it within VS Code. Following this, I installed Prompt Flow using pip. However, the Prompt Flow extension does not seem to recognize the installed libraries, even though they are present in the virtual environment.

I'm aware that extensions in VS Code might have issues detecting packages installed in a virtual environment, but I'm unsure how to configure VS Code or the Prompt Flow extension to recognize the installed packages in my active virtual environment.

Here's what I've done so far:

Downloaded and installed VS Code.
Installed the Prompt Flow extension.
Created and activated a virtual environment using venv.
Installed Prompt Flow using pip within the virtual environment.

Despite these steps, the Prompt Flow extension isn't detecting the installed Prompt Flow libraries. I would appreciate any guidance on how to resolve this issue or steps to ensure that VS Code extensions recognize packages installed in a virtual environment.

Thank you in advance for your help!

2

There are 2 best solutions below

0
On

Based on the documentation, you need to install promptflow and promptflow-tools installed correctly on your working environment to get the prompt-flow extension to recognize the working environment as flow.

Below are the steps you can refer:

  • Create Environment
python -m venv testenv  
  • Activate Environment
.\testenv\Scripts\activate   
  • Install required packages
pip install promptflow promptflow-tools
  • Install promptflow extension from VS code extensions.

enter image description here

Once you have done this, you will able to see the your working environment in Flows section. enter image description here

For more details you can check this tutorial.

0
On

It may happened that you installed the Prompt flow extension prior to creating Python virtual environment. If that is the case try going to "Install dependencies" page of the extension and selecting Python interpreter available inside venv instead of the global one.

enter image description here