azure-search-openai-demo
azure-search-openai-demo copied to clipboard
ModuleNotFoundError: No module named '_cffi_backend'
Please provide us with the following information:
This issue is for a: (mark with an x)
- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Running locally: Run azd login Change dir to app Run ./start.ps1 or ./start.sh or run the "VS Code Task: Start App" to start the project locally.
Any log messages given by the failure
Starting backend
ModuleNotFoundError: No module named 'cffi_backend'
thread 'RUST_BACKTRACE=1 environment variable to display a backtrace
Traceback (most recent call last):
File "C:\Users\A556056\OneDrive - Atos\Documents\Projetos\Pessoal\GitHub\azure-search-openai-demo\app\backend\app.py", line 8, in
Expected/desired behavior
Successful deployment
OS and Version?
Windows 11
azd version?
azd version 1.0.2
Versions
Python 3.11 - 64 bit
Mention any other details that might be useful
I am trying to run locally following the README instructions and using Azure OpenAI in another resource group. Both are in the same subscription and I am the owner/admin.
Thanks! We'll be in touch soon.
I have gotten that error a few times. I resolve it by changing my Python setup, like changing what Python version I'm using. Do you know what version you're using now? And can you change to a different version? Another option is to use GitHub Codespaces.
I have gotten that error a few times. I resolve it by changing my Python setup, like changing what Python version I'm using. Do you know what version you're using now? And can you change to a different version? Another option is to use GitHub Codespaces.
Please, what version of Python are you using? I'm on 3.11 (64 bit).
It just worked for me with Python 3.10 inside a Dev Container. It doesn't work when I use my Mac's standard Python 3.9 installation. I think there may be an issue with the packages installed, there's a number of suggestions in this thread about reinstalling cffi:
https://stackoverflow.com/questions/34370962/no-module-named-cffi-backend
I think it's worth trying those, since Python 3.11 should theoretically be a good version.
It just worked for me with Python 3.10 inside a Dev Container. It doesn't work when I use my Mac's standard Python 3.9 installation. I think there may be an issue with the packages installed, there's a number of suggestions in this thread about reinstalling cffi:
https://stackoverflow.com/questions/34370962/no-module-named-cffi-backend
I think it's worth trying those, since Python 3.11 should theoretically be a good version.
I changed my Python version to 3.10 and the issue is resolved. Thanks @pamelafox !
Okay great. I'm going to send a PR to update the Dev Container to make it more likely for other folks to not run into this issue, for devs using the Dev Container. Keeping this issue open as reference for that PR.
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.
@pamelafox ... I faced the same issue. There is a scenario for me which can regenerate the error is: I already deployed the code having python 3.10 on my local. Now when I switched to Python 3.11 and ran "start.ps1" I got this error. Also I got same error when I had to add new file in data folder and ran "azd provision" or in general "azd up". So it was calling scripts at the backend.
Now when I uploaded the new document and tried "azd provision" or "azd up", in this scenario I deleted the virtual env, created during the steps. I re-ran the command after deleting virtual env.
In scenario of running, "start.ps1" I faced the same error and i deleted the virtual environment created their as well. I re-ran and it is resolved.
So I found why it is not working in 3.11 and 3.10 only because the libraries in the virtual environment are support for 3.10 initially and when I switched to 3.11 it was not supported because of already installed libraries.