quic/ai-hub-models

[BUG] Windows install Whisper not working

Closed this issue · 7 comments

Describe the bug
Dependencies not there

To Reproduce

conda create -n whisper python=3.12.7
conda activate whisper
conda install conda-forge::ffmpeg

cd C:\Users\<user_name>\miniconda3\envs\whisper

copy the 4 file of 
[code of](https://github.com/quic/ai-hub-apps/tree/main/apps/windows/python/Whisper) 
to  
C:\Users\<user_name>\miniconda3\envs\whisper

py -m pip install -r requirements.txt




Expected behavior
I expected that the above would run and that I then finally could run

py -m qai-hub-models.models.whisper_base_en.export --target-runtime onnx
py demo.py --audio_path /path/to/test/data.mp3

To get the first thing running.

Stack trace
(whisper) C:\Users<user_name>\miniconda3\envs\whisper>py -m pip install -r requirements.txt
Collecting opencv-python (from -r requirements.txt (line 1))
Using cached opencv-python-4.10.0.84.tar.gz (95.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\cli\base_command.py", line 105, in _run_wrapper
status = _inner_run()
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\cli\base_command.py", line 96, in _inner_run
return self.run(options, args)
~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\cli\req_command.py", line 67, in wrapper
return func(self, options, args)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\commands\install.py", line 379, in run
requirement_set = resolver.resolve(
reqs, check_supported_wheels=not options.target_dir
)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
~~~~~~~~~~~~~~~~^
collected.requirements, max_rounds=limit_how_complex_resolution_can_be
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
^^^^^^^^^^^^^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\resolvelib\structs.py", line 156, in bool
return bool(self._sequence)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 174, in bool
return any(self)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 162, in
return (c for c in iterator if id(c) not in self._incompatible_ids)
^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 53, in _iter_built
candidate = func()
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py", line 187, in _make_candidate_from_link
base: Optional[BaseCandidate] = self._make_base_candidate_from_link(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
link, template, name, version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py", line 233, in _make_base_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
~~~~~~~~~~~~~^
link,
^^^^^
...<3 lines>...
version=version,
^^^^^^^^^^^^^^^^
)
^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 304, in init
super().init(
~~~~~~~~~~~~~~~~^
link=link,
^^^^^^^^^^
...<4 lines>...
version=version,
^^^^^^^^^^^^^^^^
)
^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 159, in init
self.dist = self._prepare()
~~~~~~~~~~~~~^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 236, in _prepare
dist = self._prepare_distribution()
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 315, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\operations\prepare.py", line 527, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\operations\prepare.py", line 642, in _prepare_linked_requirement
dist = _get_prepared_distribution(
req,
...<3 lines>...
self.check_build_deps,
)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\operations\prepare.py", line 72, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
finder, build_isolation, check_build_deps
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\distributions\sdist.py", line 56, in prepare_distribution_metadata
self._install_build_reqs(finder)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\distributions\sdist.py", line 126, in _install_build_reqs
build_reqs = self._get_build_requires_wheel()
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\distributions\sdist.py", line 103, in _get_build_requires_wheel
return backend.get_requires_for_build_wheel()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_internal\utils\misc.py", line 701, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\pyproject_hooks_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'config_settings': config_settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
})
^^
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\pyproject_hooks_impl.py", line 321, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 77, in build_backend
obj = import_module(mod_path)
File "C:\Users<user_name>\AppData\Local\Programs\Python\Python313-arm64\Lib\importlib_init
.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1022, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users<user_name>\AppData\Local\Temp\pip-build-env-wgih5ett\overlay\Lib\site-packages\setuptools_init
.py", line 10, in
import distutils.core
ModuleNotFoundError: No module named 'distutils''

Host configuration:

  • OS and version: Windows 11
  • CPU: Qualcomm X Elite x1e0-78-100

Additional context
:(

so here as well

setuptools

is missing the the requirements.txt

And again the

  AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

error after installing setuptools using

py -m install setuptools

and then re-running requirements.txt

How to fix it

Not fixed

python -m qai-hub-models.models.whisper_base_en.export --target-runtime onnx

C:\Users<user_name>\miniconda3\envs\whisper\python.exe: Error while finding module specification for 'qai-hub-models.models.whisper_base_en.export' (ModuleNotFoundError: No module named 'qai-hub-models')

Typo in readme: https://github.com/quic/ai-hub-apps/blob/main/apps/windows/python/Whisper/README.md

Instruction needs to be

python -m qai_hub_models.models.whisper_base_en.export --target-runtime onnx

not

python -m qai-hub-models.models.whisper_base_en.export --target-runtime onnx

(underscore vs dash)

as in line with:

https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/whisper_base_en
qai_hub_models/models/whisper_base_en

and don't forget to run

pip install "qai_hub_models[whisper_base_en]"

How should I use:
https://aihub.qualcomm.com/models/whisper_base_en?chipsets=Snapdragon+X+Elite

click "download model" on the link above to get a S3 link with temporary access to download:

https://tetrahub-qprod-userdata.s3.amazonaws.com/models/mmdyv5ywm_GLlPHt0OMqSg80pW.bin

I see an ONNX file and bin files.
How can I use those?
And how can I use them in a way that they run on the GPU/NPU and have a nice UI, like ONNX-web or Forge WebUI?

kory commented

Typo in readme: https://github.com/quic/ai-hub-apps/blob/main/apps/windows/python/Whisper/README.md

Thanks for the report. We've actually fixed this already (yay!) and it will be included in the next release of AI Hub Apps.

I see an ONNX file and bin files. How can I use those?

Great question. The ONNX files you can download here are used by the whisper python demo you linked to above. The context binaries (.bin) are more complex. I recommend you reach out on our Slack so we can communicate more directly about this (ONNX, and Context Binaries)

AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

I see "Python313" in your error message. Are you using Python 3.13?

I've seen similar errors before when trying it. We don't support 3.13--our supported pythons are 3.9, 3.10, 3.11, and 3.12.

@kory I discovered that the two different virtualiseren work opposite

For venv you need to use py to run the local python version, for corda it's the opposite.
And to make it worse, some install scripts point hardcoded to the %USER ... python folder so, no matter what python version you use to run that script, some parts point to the system version.

That's for the one needed for Olive.