piper icon indicating copy to clipboard operation
piper copied to clipboard

Piper TTS will not run on Huggingface

Open raivisdejus opened this issue 8 months ago • 1 comments

I have an example space on Huggingface with piper-tts as dependency. Starting the space I get error:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/home/user/app/app.py", line 6, in <module>
    from piper import PiperVoice
  File "/usr/local/lib/python3.10/site-packages/piper/__init__.py", line 1, in <module>
    from .voice import PiperVoice
  File "/usr/local/lib/python3.10/site-packages/piper/voice.py", line 9, in <module>
    import onnxruntime
  File "/usr/local/lib/python3.10/site-packages/onnxruntime/__init__.py", line 23, in <module>
    from onnxruntime.capi._pybind_state import ExecutionMode  # noqa: F401
  File "/usr/local/lib/python3.10/site-packages/onnxruntime/capi/_pybind_state.py", line 32, in <module>
    from .onnxruntime_pybind11_state import *  # noqa
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "/home/user/app/app.py", line 6, in <module>
    from piper import PiperVoice
  File "/usr/local/lib/python3.10/site-packages/piper/__init__.py", line 1, in <module>
    from .voice import PiperVoice
  File "/usr/local/lib/python3.10/site-packages/piper/voice.py", line 9, in <module>
    import onnxruntime
  File "/usr/local/lib/python3.10/site-packages/onnxruntime/__init__.py", line 57, in <module>
    raise import_capi_exception
  File "/usr/local/lib/python3.10/site-packages/onnxruntime/__init__.py", line 23, in <module>
    from onnxruntime.capi._pybind_state import ExecutionMode  # noqa: F401
  File "/usr/local/lib/python3.10/site-packages/onnxruntime/capi/_pybind_state.py", line 32, in <module>
    from .onnxruntime_pybind11_state import *  # noqa
ImportError

Adding requirement for numpy==1.26.4 fixes the issue, but most likely some adjustment to piper-tts dependencies can prevent it in the first place

raivisdejus avatar Jun 17 '24 04:06 raivisdejus