Error with Annoy module in virtual environment when using NemoGuardrails in a Streamlit app

I've encountered an issue with the Annoy module within my virtual environment while developing a Streamlit app that incorporates LangChain, OpenAI, and NemoGuardrails. Despite installing the Annoy module within the virtual environment, I consistently receive a "no module named annoy" error when running my app. Here are the steps I've taken to troubleshoot:

  1. Confirmed the installation of the Annoy module within the virtual environment using pip list.
  2. Activated the virtual environment using source venv/bin/activate.
  3. Verified that the Python script is utilizing the correct Python interpreter from the virtual environment.
  4. Attempted to dynamically install the Annoy module at the beginning of the script using subprocess.call(['pip', 'install', 'annoy']), followed by import annoy.

Despite these efforts, the error persists. Could anyone provide insights or suggestions on how to resolve this issue? Any assistance would be greatly appreciated. Thank you!

Upvotes: 0

Views: 229

Answers (1)

SRaj
SRaj

Reputation: 11

Could you fix this issue? I also faced the same issue. However, I realized if I change the configuration in my virtual environment to "include-system-site -packages = true", I am able to run it. The packages are installed in the global environment and not in the virtual environment as I see.

Upvotes: 0

Related Questions