Skip to content

Instantly share code, notes, and snippets.

@mprymek
Created November 11, 2022 17:42
Show Gist options
  • Save mprymek/c753c6aa2ec94b35d030494ccace89ad to your computer and use it in GitHub Desktop.
Save mprymek/c753c6aa2ec94b35d030494ccace89ad to your computer and use it in GitHub Desktop.
# How to upgrade Porcupine 1.9.x installed by Rhasspy 2.5.11 DEB to version 2.x
sudo su -
# Install Rhasspy 2.5.11 (replace "armel" with your architecture if needed)
wget https://github.com/rhasspy/rhasspy/releases/download/v2.5.11/rhasspy_armel.deb
dpkg -i rhasspy_armel.deb
# If you have Rhasspy already installed, just stop it.
systemctl stop rhasspy
# Install latest Porcupine.
apt update
apt install -y python3-pip
pip3 install pvporcupine
# Set installed Porcupine version in the variable below
porcupine_ver=2.1.4
# Porcupine is installed in /usr/local/lib/python3.?/dist-packages/pvporcupine
# Check it:
echo /usr/local/lib/python3.?/dist-packages/pvporcupine
# If you see anything other than "python3.7" in the path, change "3.7"
# in the variable below to the version you see...
pyver=3.7
# Move old Porcupine into ~/bcp-pvporcupine-1.9 and replace it with symlinks
# to the new version.
mkdir bcp-pvporcupine-1.9
mv /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine-1.9.*.dist-info bcp-pvporcupine-1.9/
mv /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine bcp-pvporcupine-1.9/
ln -s /usr/local/lib/python$pyver/dist-packages/pvporcupine \
/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine
ln -s /usr/local/lib/python$pyver/dist-packages/pvporcupine-$porcupine_ver.dist-info \
/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine-$porcupine_ver.dist-info
# Patch Rhasspy.
curl https://gist.githubusercontent.com/mprymek/f72474052aa39687af266f572e76675e/raw/7c107124faf7d7a21bdc101ba2f27bf0f9fb0f36/rhasspy-porcupine-v2.diff \
| patch -d / -p0
# (optional) Put your custom wake word file to .config/rhasspy/profiles/en/porcupine
#
# Configure your Porcupine access key and your custom wake word file in your
# profile.json:
# "wake": {
# "porcupine": {
# "keyword_path": "hey-hilly_en_raspberry-pi_v2_1_0.ppn",
# "sensitivity": "0.6",
# "access_key": "blahblahblahblahblahblahblahblahblahblahblahblahblahbl=="
# },
# "system": "porcupine"
# }
# If everything went well, you can now start Rhasspy.
systemctl start rhasspy
@lightsabata
Copy link

lightsabata commented Jul 21, 2023

hi, is this script supposed to work with porcupine 2.2.1 ?
i can't manage to make porcupine work when running rhasspy
(i've edited the variables pyver to 3.9 and porcupine_ver to 2.2.1):

Traceback (most recent call last):
  File "/usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__init__.py", line 263, in detection_thread_proc
    model_path=self.model_path,
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine/_factory.py", line 74, in create
    sensitivities=sensitivities)
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine/_porcupine.py", line 158, in __init__
    raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
pvporcupine._porcupine.PorcupineInvalidArgumentError```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment