I am using vosk to compare user voice and given text to read, and print out an accuracy json. I am able to run vosk separately via the terminal and get results. But when i try to run it through flask i get the following error.
flask.cli.NoAppException: While importing "app", an ImportError was raised:
Traceback (most recent call last):
File "/home/prks18/.local/lib/python3.8/site-packages/flask/cli.py", line 240, in locate_app
__import__(module_name)
File "/home/CODE/Flask/app.py", line 5, in <module>
from vosk import aligner
ImportError: cannot import name 'aligner' from 'vosk' (/home/myfolder/.local/lib/python3.8/site-packages/vosk/__init__.py)
` i found out that flask is trying to get the package from python3.8 folder while the aligner package is in /usr/local/lib/python3.10/site-packages/vosk-0.3.32-py3.10.egg/vosk/aligner/init.py
How to make flask grab it from the latter folder?
I, suggest you to consider using a virtual environment, so that package installation can be constrained to a particular Python version, instead of choosing the system default, as,
virtualenv -p python3.10 venv