Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing environments without running azd up #2382

Open
ltim-rkm opened this issue Feb 25, 2025 · 2 comments
Open

Sharing environments without running azd up #2382

ltim-rkm opened this issue Feb 25, 2025 · 2 comments

Comments

@ltim-rkm
Copy link

ltim-rkm commented Feb 25, 2025

Hello,

I am able to deploy the app in Azure App service and run locally. Now, I wanted to share this with my colleague, I followed the steps mentioned here: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/docs/sharing_environments.md

On my colleague's machine, I just ran start.ps1 without running azd up and I keep getting below error about a python module:

PS C:\Users\VarSh\Downloads\poc\poc\app\backend> python -m quart --app main:app run --port 50505 --host localhost --reload
Usage: python -m quart run [OPTIONS]
Try 'python -m quart run --help' for help.
 
Error: While importing 'main', an ImportError was raised:
 
Traceback (most recent call last):
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\quart\cli.py", line 175, in locate_app
    module = import_module(module_name)
  File "C:\Program Files\Python313\Lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\Users\VarSh\Downloads\poc\poc\app\backend\main.py", line 3, in <module>
    from app import create_app
  File "C:\Users\VarSh\Downloads\poc\poc\app\backend\app.py", line 19, in <module>
    from azure.identity.aio import (
    ...<3 lines>...
    )
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\__init__.py", line 10, in <module>
    from ._credentials import (
    ...<19 lines>...
    )
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\_credentials\__init__.py", line 5, in <module>
    from .authorization_code import AuthorizationCodeCredential
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\_credentials\authorization_code.py", line 9, in <module>
    from .._internal.aad_client import AadClient
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\_internal\__init__.py", line 5, in <module> 
    from .aad_client import AadClient
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\_internal\aad_client.py", line 11, in <module>
    from .aad_client_base import AadClientBase
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\_internal\aad_client_base.py", line 20, in <module>
    from .aadclient_certificate import AadClientCertificate
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\azure\identity\_internal\aadclient_certificate.py", line 7, in <module>
    from cryptography import x509
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\cryptography\x509\__init__.py", line 7, in <module>        
    from cryptography.x509 import certificate_transparency, verification
  File "C:\Users\VarSh\Downloads\poc\poc\app\.venv\Lib\site-packages\cryptography\x509\certificate_transparency.py", line 11, in <module>
    from cryptography.hazmat.bindings._rust import x509 as rust_x509
ModuleNotFoundError: No module named '_cffi_backend'

After trying various ways to get this module installed, this error does not disappear. My question is:

  1. Does my colleague need to run azd up to be able to run start.ps1 successfully in order to resolve the python module import error? It seems weird.

Please advise.

Thanks

@pamelafox
Copy link
Collaborator

I've seen this error before:

"ModuleNotFoundError: No module named '_cffi_backend'"

It's a fairly common error, so you'll also find StackOverflow posts about it. For me, it often happens when I create a .venv inside a Dev Container, and then I use that .venv outside of the Dev Container. However, if you haven't been messing with dev containers, it probably has a different cause, so I recommend checking StackOverflow threads about it. You can also check their Python version and try a different version (3.11/3.12 is generally good).

Your colleague shouldn't need to have to run azd up, but they will need to resolve that Python error.

@ltim-rkm
Copy link
Author

ltim-rkm commented Mar 6, 2025

@pamelafox thanks a lot for your response. As you rightly advised, I already followed up many stack overflow pages and manually installed and uninstalled this dependency(cffi) via pip but still the error does not disappear while the module is already installed and shows up in the lib folder. We are not creating any dev container but just running the start.ps1. Also, we tried running individual steps of the script of start.ps1 but the error remains as is. I think the python version on my colleague's machine is 3.13. I will try to move to 3.12 and try again. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants