How to manually install Piper

Edit: Piper image was rolled back to previous version, and is working again.

Anyone got issues with Piper and the latest image? It was working before I updated today.

Whisper continues to work, but HA is unable to connect to the Piper container.

Logger: aiohttp.server
Source: components/wyoming/data.py:69
First occurred: 09:53:06 (4 occurrences)
Last logged: 09:54:52

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 297, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 393, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/config_flow.py", line 41, in async_step_user
    service = await WyomingService.create(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 37, in create
    info = await load_wyoming_info(host, port)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 69, in load_wyoming_info
    wyoming_info = Info.from_event(event)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in from_event
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in <listcomp>
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/util/dataclasses_json.py", line 17, in from_dict
    field = cls_fields[key]
            ~~~~~~~~~~^^^^^
KeyError: 'description'

And

Logger: homeassistant.config_entries
Source: components/wyoming/data.py:69
First occurred: 09:51:42 (2 occurrences)
Last logged: 09:51:42

Error setting up entry piper-en for wyoming
Error setting up entry piper-da for wyoming
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/__init__.py", line 18, in async_setup_entry
    service = await WyomingService.create(entry.data["host"], entry.data["port"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 37, in create
    info = await load_wyoming_info(host, port)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 69, in load_wyoming_info
    wyoming_info = Info.from_event(event)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in from_event
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in <listcomp>
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/util/dataclasses_json.py", line 17, in from_dict
    field = cls_fields[key]
            ~~~~~~~~~~^^^^^
KeyError: 'description'

I cannot install Piper (via the Wyoming protocol) and this may be the reason why. I had it working ages ago as a test and then stopped it until I had time to play (i.e. now). What is the tag for the last working version?

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