Azure-Samples / azure-search-openai-demo

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
https://azure.microsoft.com/products/search
MIT License
5.96k stars 4.09k forks source link

How to fix missing modules in your Python environment issue? #106

Open kajasherif opened 1 year ago

kajasherif commented 1 year ago
Running "prepdocs.py"
ModuleNotFoundError: No module named '_cffi_backend'
thread '<unnamed>' panicked at 'Python API call failed', C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\pyo3-0.15.2\src\err\mod.rs:582:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\prepdocs.py", line 9, in <module>       
    from azure.identity import AzureDeveloperCliCredential
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\__init__.py", line 10, in <module>
    from ._credentials import (
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\_credentials\__init__.py", line 5, in <module>
    from .authorization_code import AuthorizationCodeCredential
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\_credentials\authorization_code.py", line 9, in <module>
    from .._internal.aad_client import AadClient
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\_internal\__init__.py", line 5, in <module>
    from .aad_client import AadClient
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\_internal\aad_client.py", line 11, in <module>
    from .aad_client_base import AadClientBase
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\_internal\aad_client_base.py", line 23, in <module>
    from .aadclient_certificate import AadClientCertificate
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\azure\identity\_internal\aadclient_certificate.py", line 7, in <module>
    from cryptography import x509
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\cryptography\x509\__init__.py", line 6, in <module>
    from cryptography.x509 import certificate_transparency
  File "D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\Lib\site-packages\cryptography\x509\certificate_transparency.py", line 10, in <module>
    from cryptography.hazmat.bindings._rust import x509 as rust_x509
pyo3_runtime.PanicException: Python API call failed

Executing predeploy hook => C:\Users\kajas\AppData\Local\Temp\azd-predeploy-1074636764.ps1

I tried D:\CodeSpace\Azure\azure-search-openai-demo\scripts\.venv\scripts\python.exe -m pip install cffi but not working in this method, again I will get same issue...

krepko7 commented 1 year ago

I have this same issue once I moved to a new laptop.

vhvb1989 commented 1 year ago

Try adding cffi to requeriments

According to this, you might need also: paramiko and cryptography

After you add the libs to requeriments, delete the .venv folder and run prepdocs.ps1 again

Pancat007 commented 11 months ago

I tried to run the project in VS code locally, but I have similar issue but the module that I missed is quart, I have added quart in /app/requirements.txt, /scripts/requirements.txt, but none of them worked, I have manually install via pip install, still useless, anyone know how to fix this?

pamelafox commented 11 months ago

@Pancat007 Are you using a virtual environment or VS Code? Can you share the full results of running ./start.sh? That should have installed quart for you, so I'm curious if there are any errors there. What Python version are you using?

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.