How to manually install Piper

Latest should be working since yesterday afternoon.

Check the logs of the container that you got the right arguments and it’s ready.

1 Like

boom!

I last pulled piper yesterday morning and didn’t realise there had been an update since. Thanks! :smiley:

Just unlucky timing!

1 Like

I pulled the latest rhasspy/wyoming-piper image as of this morning, and I’m getting a 404 in the container logs when it’s apparently trying to download the language onnx file. I tried to download these files preemptively and put them in the /data folder for the container, but it still yields the same 404 error.

Unfortunately, it’s not logging the actual URL it’s trying to pull from. At the very least, it could check for the existence of the files in the /data folder before trying to download them again.

docker-compose.yaml fragment:

  piper_lessac:
    hostname: homeassistant-piper
    image: rhasspy/wyoming-piper
    restart: unless-stopped
    command: --voice en_US-lessac-high
    environment:
      TZ: "America/Halifax"
    networks:
      - default
    ports:
      - 8126:10200
    volumes:
      - ./piper_lessac:/data

Contents of piper container /data folder (downloaded from rhasspy/piper-voices at v1.0.0):

$ ls -lF ./piper_lessac
total 109M
-rw-r--r-- 1 root root 109M Jun 26 17:26 en_US-lessac-high.onnx
-rw-r--r-- 1 root root 6.9K Jul 15 14:15 en_US-lessac-high.onnx.json
-rw-r--r-- 1 root root  347 Jul 15 14:15 MODEL_CARD

Error logs:

$ docker-compose up piper_lessac
homeassistant_piper_lessac_1 is up-to-date
Attaching to homeassistant_piper_lessac_1
piper_lessac_1  | INFO:__main__:Downloading en_US-lessac-high to /data
piper_lessac_1  | Traceback (most recent call last):
piper_lessac_1  |   File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
piper_lessac_1  |     return _run_code(code, main_globals, None,
piper_lessac_1  |   File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
piper_lessac_1  |     exec(code, run_globals)
piper_lessac_1  |   File "/usr/local/lib/python3.9/dist-packages/wyoming_piper/__main__.py", line 147, in <module>
piper_lessac_1  |     asyncio.run(main())
piper_lessac_1  |   File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
piper_lessac_1  |     return loop.run_until_complete(main)
piper_lessac_1  |   File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
piper_lessac_1  |     return future.result()
piper_lessac_1  |   File "/usr/local/lib/python3.9/dist-packages/wyoming_piper/__main__.py", line 70, in main
piper_lessac_1  |     voice_onnx = download_voice(args.voice, args.download_dir)
piper_lessac_1  |   File "/usr/local/lib/python3.9/dist-packages/wyoming_piper/download.py", line 20, in download_voice
piper_lessac_1  |     with urlopen(voice_url) as response:
piper_lessac_1  |   File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
piper_lessac_1  |     return opener.open(url, data, timeout)
piper_lessac_1  |   File "/usr/lib/python3.9/urllib/request.py", line 523, in open
piper_lessac_1  |     response = meth(req, response)
piper_lessac_1  |   File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
piper_lessac_1  |     response = self.parent.error(
piper_lessac_1  |   File "/usr/lib/python3.9/urllib/request.py", line 561, in error
piper_lessac_1  |     return self._call_chain(*args)
piper_lessac_1  |   File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
piper_lessac_1  |     result = func(*args)
piper_lessac_1  |   File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
piper_lessac_1  |     raise HTTPError(req.full_url, code, msg, hdrs, fp)
piper_lessac_1  | urllib.error.HTTPError: HTTP Error 404: Not Found

Seems to have fixed itself!

@bjorn.sivertsen

Today I tried to update my piper image to latest one (I never updated it since it was available on HA), and I got the same error as you 20d ago when trying to reconfigure the wyoming/piper integration on HA :

piper    | ERROR:asyncio:Task exception was never retrieved
piper    | future: <Task finished name='Task-6' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:28> exception=ConnectionResetError(104, 'Connection reset by peer')>
piper    | Traceback (most recent call last):
piper    |   File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 31, in run
piper    |     event = await async_read_event(self.reader)
piper    |   File "/usr/local/lib/python3.9/dist-packages/wyoming/event.py", line 62, in async_read_event
piper    |     json_line = await reader.readline()
piper    |   File "/usr/lib/python3.9/asyncio/streams.py", line 540, in readline
piper    |     line = await self.readuntil(sep)
piper    |   File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil
piper    |     await self._wait_for_data('readuntil')
piper    |   File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data
piper    |     await self._waiter
piper    |   File "/usr/lib/python3.9/asyncio/selector_events.py", line 856, in _read_ready__data_received
piper    |     data = self._sock.recv(self.max_size)
piper    | ConnectionResetError: [Errno 104] Connection reset by peer

I’m using this image :

rhasspy/wyoming-piper latest b269adc0797a 35 hours ago 178MB

Could you tell my which image ID you are using ? Did you try with the latest ?

edit : moved back to image: “rhasspy/wyoming-piper:0.0.2” and it’s working now…

edit2 : issue has been open : Piper doesn't start - Service exited with code 1 (by signal 0) · Issue #3163 · home-assistant/addons · GitHub

1 Like

Not sure the Piper/Whisper combo are quite ready for primetime

It is working beautifully for me, what do you mean?

https://community.home-assistant.io/t/anyone-successfully-using-piper-whisper/
and

Odd, it’s working here. And has for a long time. But I am also only mostly using it for TTS announcements over speakers. So perhaps I haven’t run into many issues yet because of that.

ah yes it’s the combo. My issue seems more related to Whisper

1 Like

Is this language related?
I have been using stt and tts without issue for a few months now. I am using English if that is helpful.

Hello,
I’m having some issues also. Here follows the fragment of my compose file:

  whisper:
    container_name: whisper
    image: rhasspy/wyoming-whisper:latest
    command: --model base-int8 --language it
    volumes:
      - /home/giorgio/dockData/whisper:/data
    environment:
      - TZ=Europe/Paris
    restart: unless-stopped
    network_mode: host 
    #ports:
    #  - 10300:10300

  piper:
    container_name: piper
    image: rhasspy/wyoming-piper:latest
    command: --voice it_IT-riccardo-x_low
    volumes:
      - /home/giorgio/dockData/piper:/data
    environment:
      - TZ=Europe/Paris
    restart: unless-stopped
    network_mode: host 
    #ports:
    #  - 10200:10200

I switched to network_mode: host since I already had some issues with ports in the past but I get the same results with port or network configurations for these two containers.
The containers seems to run fine (I have INFO:__main__:Ready in the logs for both piper and whisper) but I cannot connect to them using the Wyoming Protocol integration: when I set the ip adress of my machine (where home assistant is also running) and the port (either 10200 or 10300) I get Unknown error occurred.
Thanks in advance for any help!

Check any firewall on the host?
Did you try localhost:<port>
Can you open a shell into the containers and ping any of the others?
Cheers.

Thanks for the suggestions. I have the Ubuntu Firewall indeed (ufw). However, I tried to disable it to check and nothing changed. I will try to ping later in the day.

For those of you who got it running is it working faster than the Home Assistant cloud integration?

1 Like

Has anybody been successful in configuring the secondary options?

  wyoming-piper:
    image: rhasspy/wyoming-piper:latest
    container_name: whisper-piper
    ports:
      - 10200:10200
    volumes:
      - ${DOCKERCONFDIR}/piper/data:/data
    command: --voice en_US-ryan-high --noise_scale 0.667 --noise_w 0.333 --update_voices

Results in an error:

__main__.py: error: the following arguments are required: --voice
usage: __main__.py
       [-h]
       --piper
       PIPER
       --voice
       VOICE
       [--uri URI]
       --data-dir
       DATA_DIR
       [--download-dir DOWNLOAD_DIR]
       [--speaker SPEAKER]
       [--noise-scale NOISE_SCALE]
       [--length-scale LENGTH_SCALE]
       [--noise_w NOISE_W]
       [--auto-punctuation AUTO_PUNCTUATION]
       [--samples-per-chunk SAMPLES_PER_CHUNK]
       [--max-piper-proc MAX_PIPER_PROCS]
       [--update-voices]
       [--debug]

I know I have done something wrong with the command line because this works.

  wyoming-piper:
    image: rhasspy/wyoming-piper:latest
    container_name: whisper-piper
    ports:
      - 10200:10200
    volumes:
      - ${DOCKERCONFDIR}/piper/data:/data
    command: --voice en_US-ryan-high

Any help is appreciated.

Try this?

wyoming-piper:
    image: rhasspy/wyoming-piper:latest
    container_name: whisper-piper
    ports:
       - 10200:10200
    volumes:
       - ${DOCKERCONFDIR}/piper/data:/data
    command: 
       --voice en_US-ryan-high 
       --noise_scale 0.667 
       --noise_w 0.333 
       --update_voices

Hi all,

I recently updated HAOS to the latest version: 2024.1.3. Piper installed in a Docker container suddenly no longer executes TTS in any of my automations, nor does manually using developer tools to run the TTS service. Running HAOS on a Pi4, and externally running Piper & Whisper on a VM running Docker. Whisper appears to be still be working. I found the following in the logs:

Source: components/wyoming/tts.py:125
First occurred: January 16, 2024 at 7:02:05 PM (5 occurrences)
Last logged: 12:46:18 PM

Error doing job: Exception in callback SpeechManager._async_get_tts_audio.<locals>.handle_error(<Task cancell...nit__.py:691>>) at /usr/src/homeassistant/homeassistant/components/tts/__init__.py:757
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 759, in handle_error
    if audio_task.exception():
       ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 701, in get_tts_data
    extension, data = await engine_instance.internal_async_get_tts_audio(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 451, in internal_async_get_tts_audio
    return await self.async_get_tts_audio(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/tts.py", line 125, in async_get_tts_audio
    event = await client.read_event()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/client.py", line 25, in read_event
    return await async_read_event(self._reader)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/event.py", line 77, in async_read_event
    json_line = await reader.readline()
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 548, in readline
    line = await self.readuntil(sep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 640, in readuntil
    await self._wait_for_data('readuntil')
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 525, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

In the Docker Container logs:

AssertionError
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-33' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:26> exception=AssertionError()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 32, in run
    if not (await self.handle_event(event)):
  File "/usr/local/lib/python3.9/dist-packages/wyoming_piper/handler.py", line 45, in handle_event
    synthesize = Synthesize.from_event(event)
  File "/usr/local/lib/python3.9/dist-packages/wyoming/tts.py", line 26, in from_event
    assert event.data is not None
AssertionError
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-36' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:26> exception=AssertionError()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 32, in run
    if not (await self.handle_event(event)):
  File "/usr/local/lib/python3.9/dist-packages/wyoming_piper/handler.py", line 45, in handle_event
    synthesize = Synthesize.from_event(event)
  File "/usr/local/lib/python3.9/dist-packages/wyoming/tts.py", line 26, in from_event
    assert event.data is not None
AssertionError
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-39' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:26> exception=AssertionError()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 32, in run
    if not (await self.handle_event(event)):
  File "/usr/local/lib/python3.9/dist-packages/wyoming_piper/handler.py", line 45, in handle_event
    synthesize = Synthesize.from_event(event)
  File "/usr/local/lib/python3.9/dist-packages/wyoming/tts.py", line 26, in from_event
    assert event.data is not None
AssertionError

Any ideas? Thanks in advanced.

This could happen if empty text is being sent. But that’s not supposed to happen either!
I’ve made a note to check it out, thanks.