rhasspy / piper

A fast, local neural text to speech system
https://rhasspy.github.io/piper-samples/
MIT License
6.8k stars 498 forks source link

Piper TTS will not run on Huggingface #524

Open raivisdejus opened 5 months ago

raivisdejus commented 5 months ago

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

C-Loftus commented 4 months ago

Also having this issue but on Ubuntu 24.04. Any fix without needing to rebuild and compile things from scratch?

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/host/.local/bin/piper", line 5, in <module>
    from piper.__main__ import main
  File "/home/host/.local/lib/python3.11/site-packages/piper/__init__.py", line 1, in <module>
    from .voice import PiperVoice
  File "/home/host/.local/lib/python3.11/site-packages/piper/voice.py", line 9, in <module>
    import onnxruntime
  File "/home/host/.local/lib/python3.11/site-packages/onnxruntime/__init__.py", line 23, in <module>
    from onnxruntime.capi._pybind_state import ExecutionMode  # noqa: F401
  File "/home/host/.local/lib/python3.11/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/host/.local/bin/piper", line 5, in <module>
    from piper.__main__ import main
  File "/home/host/.local/lib/python3.11/site-packages/piper/__init__.py", line 1, in <module>
    from .voice import PiperVoice
  File "/home/host/.local/lib/python3.11/site-packages/piper/voice.py", line 9, in <module>
    import onnxruntime
  File "/home/host/.local/lib/python3.11/site-packages/onnxruntime/__init__.py", line 57, in <module>
    raise import_capi_exception
  File "/home/host/.local/lib/python3.11/site-packages/onnxruntime/__init__.py", line 23, in <module>
    from onnxruntime.capi._pybind_state import ExecutionMode  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/host/.local/lib/python3.11/site-packages/onnxruntime/capi/_pybind_state.py", line 32, in <module>
    from .onnxruntime_pybind11_state import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError