You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派3 Model B部署Google Assistant启动报错求助

Fixing Google Assistant Deployment Issues on Raspberry Pi 3 Model B

Let's tackle the two errors you ran into step by step—they're both common hurdles when setting up the Assistant, and easy to resolve once you know what's going on.

First Error: Invalid Sample Rate (PortAudioError -9997)

You saw this error when first running the push-to-talk command:

INFO:root:Connecting to embeddedassistant.googleapis.com
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/env/lib/python3.5/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 434, in <module>
main()
...
sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]

This happens because the Google Assistant script is trying to use a sample rate your audio hardware doesn't support. Here's how to fix it:

  • First, check what sample rates your microphone/speaker supports. Run these commands in your terminal:
    arecord -l  # Lists your audio devices
    arecord --dump-hw-params -d <device-number>  # Replace <device-number> with your mic's ID from the first command
    
    Look for lines like sample_rate_min and sample_rate_max to find valid rates (common ones are 44100 or 48000 Hz).
  • Run the push-to-talk command again, specifying the valid sample rate with the --audio-sample-rate flag. For example:
    (env) pi@raspberrypi:~ $ python -m googlesamples.assistant.grpc.pushtotalk --audio-sample-rate 44100
    
  • Double-check your audio setup with alsamixer to make sure the correct device is selected and not muted.

Second Error: Missing Device Model ID

After fixing the audio issue, you hit this registration error:

(env) pi@raspberrypi:~ $ python -m googlesamples.assistant.grpc.pushtotalk
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: '/home/pi/.config/googlesamples-assistant/device_config.json'
INFO:root:Registering device
ERROR:root:Option --device-model-id required when registering a device instance.

This means your Pi hasn't registered itself with your Google Assistant project yet. Here's how to complete the registration:

  • Go back to the Google Actions Console where you set up your Assistant project, and locate the device model ID you created for your Raspberry Pi (if you haven't made one yet, create a new device model under your project).
  • Run the push-to-talk command again, adding the --device-model-id flag followed by your actual model ID:
    (env) pi@raspberrypi:~ $ python -m googlesamples.assistant.grpc.pushtotalk --device-model-id YOUR_UNIQUE_DEVICE_MODEL_ID
    
  • This command will generate the missing device_config.json file in /home/pi/.config/googlesamples-assistant/. After this, you can run the original push-to-talk command without the model ID flag—it will use the saved config.

内容的提问来源于stack exchange,提问作者John Clark

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:47:36