ImportError: cannot import name 'espeakbridge' from 'piper'

Hi everyone, I recently setup my PicarX following the instructions online. However, when I try to run the example for testing Piper (see 15. AI Storytelling Robot with Piper and OpenAI — SunFounder PiCar-X Kit documentation ), I get the following traceback:

rene@picar:~/picar-x/example$ sudo python3 test_tts_piper.py

2026-02-01 19:54:21.671236278 [W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: “/sys/class/drm/card1/device/vendor”

pinctrl set 20 op dh

[‘ar_JO’, ‘ca_ES’, ‘cs_CZ’, ‘cy_GB’, ‘da_DK’, ‘de_DE’, ‘el_GR’, ‘en_GB’, ‘en_US’, ‘es_ES’, ‘es_MX’, ‘fa_IR’, ‘fi_FI’, ‘fr_FR’, ‘hu_HU’, ‘is_IS’, ‘it_IT’, ‘ka_GE’, ‘kk_KZ’, ‘lb_LU’, ‘lv_LV’, ‘ml_IN’, ‘ne_NP’, ‘nl_BE’, ‘nl_NL’, ‘no_NO’, ‘pl_PL’, ‘pt_BR’, ‘pt_PT’, ‘ro_RO’, ‘ru_RU’, ‘sk_SK’, ‘sl_SI’, ‘sr_RS’, ‘sv_SE’, ‘sw_CD’, ‘tr_TR’, ‘uk_UA’, ‘vi_VN’, ‘zh_CN’]

[]

ALSA lib pcm_asym.c:105:(_snd_pcm_asym_open) capture slave is not defined

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.front.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM front

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround51.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround21

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround51.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround21

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround40.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround40

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround51.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround41

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround51.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround50

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround51.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround51

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.surround71.0:CARD=0’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM surround71

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM iec958

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM spdif

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM spdif

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

ALSA lib pcm_oss.c:404:(_snd_pcm_oss_open) Cannot open device /dev/dsp

ALSA lib pcm_oss.c:404:(_snd_pcm_oss_open) Cannot open device /dev/dsp

ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pcm_a52.c:1036:(_snd_pcm_a52_open) a52 is only for playback

ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition ‘cards.0.pcm.iec958.0:CARD=0,AES0=6,AES1=130,AES2=0,AES3=2’

ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}

ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card

ALSA lib pcm_usb_stream.c:481:(_snd_pcm_usb_stream_open) Invalid card ‘card’

ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card

ALSA lib pcm_usb_stream.c:481:(_snd_pcm_usb_stream_open) Invalid card ‘card’

ALSA lib pcm_dmix.c:973:(snd_pcm_dmix_open) The dmix plugin supports only playback stream

ALSA lib pcm_dmix.c:973:(snd_pcm_dmix_open) The dmix plugin supports only playback stream

ALSA lib pcm_dmix.c:973:(snd_pcm_dmix_open) The dmix plugin supports only playback stream

ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave

ALSA lib pcm_dmix.c:973:(snd_pcm_dmix_open) The dmix plugin supports only playback stream

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

Traceback (most recent call last):

File “/home/rene/picar-x/example/test_tts_piper.py”, line 15, in 

tts.say**("Hello! I'm Piper TTS.")**

\~\~\~\~\~\~\~**^^^^^^^^^^^^^^^^^^^^^^^^^**

File “/usr/local/lib/python3.13/dist-packages/sunfounder_voice_assistant/tts/piper.py”, line 168, in say

self.stream**(text)**

\~\~\~\~\~\~\~\~\~\~\~**^^^^^^**

File “/usr/local/lib/python3.13/dist-packages/sunfounder_voice_assistant/tts/piper.py”, line 152, in stream

for chunk in self.piper.synthesize**(text)**:

             \~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~**^^^^^^**

File “/usr/local/lib/python3.13/dist-packages/piper/voice.py”, line 285, in synthesize

sentence_phonemes = self.phonemize(text)

File “/usr/local/lib/python3.13/dist-packages/piper/voice.py”, line 233, in phonemize

\_ESPEAK_PHONEMIZER = EspeakPhonemizer(self.espeak_data_dir)

File “/usr/local/lib/python3.13/dist-packages/piper/phonemize_espeak.py”, line 17, in _init_

**from . import espeakbridge**  # avoid circular import

**^^^^^^^^^^^^^^^^^^^^^^^^^^**

ImportError: cannot import name ‘espeakbridge’ from ‘piper’ (/usr/local/lib/python3.13/dist-packages/piper/_init_.py)

rene@picar:~/picar-x/example$

I use a Raspberry Pi 5 with Debian Trixie, which has Python version 3.13.5 by default.

Can anyone please give a hint how to fix that?

Thanks!

Could you confirm whether you have installed all the library code from the correct branch?
We recommend reinstalling the system, then installing all the required libraries, and following the tutorial steps to run the setup.

Installation Steps (follow the tutorial guide):

Important notes:

Do not run the command:
sudo apt install git python3-pip python3-setuptools python3-smbus
Instead, directly install robot-hat, vilib, and picar-x.

After successfully installing all libraries, proceed to install i2samp.sh.
During the installation, select “Y” when prompted to test the speaker.

If the speaker does not produce sound after the first installation of i2samp.sh, please try reinstalling it again to check if the sound returns.

Once these steps are completed successfully, you can continue with the remaining examples as outlined in the tutorial.