azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

How to fix missing modules in your Python environment issue?

Open kajasherif opened this issue 2 years ago • 5 comments

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...

kajasherif avatar Apr 11 '23 06:04 kajasherif

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

krepko7 avatar May 18 '23 17:05 krepko7

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

vhvb1989 avatar May 18 '23 18:05 vhvb1989

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?

Pancat007 avatar Oct 13 '23 06:10 Pancat007

@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?

pamelafox avatar Oct 16 '23 17:10 pamelafox

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.

github-actions[bot] avatar Dec 30 '23 01:12 github-actions[bot]