ideasman42 / nerd-dictation

Simple, hackable offline speech to text - using the VOSK-API.
GNU General Public License v3.0
1.29k stars 108 forks source link

Install failure on Linux Mint 22 #130

Open MintMusic opened 2 months ago

MintMusic commented 2 months ago

I successfully installed and used nerd-dictation on Mint 20.

I upgraded my system to Mint 22 using Aptik. nerd-dictation no longer worked. "pip3 install vosk" is not longer valid. I used "pipx install vosk" instead. When I ran nerd-dictation, I got the following:

Traceback (most recent call last): File "/home/edwin/nerd-dictation/./nerd-dictation", line 1974, in main() File "/home/edwin/nerd-dictation/./nerd-dictation", line 1970, in main args.func(args) File "/home/edwin/nerd-dictation/./nerd-dictation", line 1835, in func=lambda args: main_begin( ^^^^^^^^^^^ File "/home/edwin/nerd-dictation/./nerd-dictation", line 1437, in main_begin found_any = text_from_vosk_pipe( ^^^^^^^^^^^^^^^^^^^^ File "/home/edwin/nerd-dictation/./nerd-dictation", line 957, in text_from_vosk_pipe import vosk # type: ignore ^^^^^^^^^^^ ModuleNotFoundError: No module named 'vosk'

I'm stuck!

beng-tang commented 1 month ago

There is a video on how to fix the Linux Mint 22 install problem here: https://www.youtube.com/watch?v=CGjXXy8yHHA

MintMusic commented 1 month ago

Thanks, beng-tang! Worked like a charm!

I will summarize what I learned from the video and used successfully:

Before starting the "Install" steps in the instructions, execute the following. sudo apt install python3-pip sudo rm /usr/lib/python3.*/EXTERNALLY-MANAGED

After that, everything works as described in the instructions.

This is ONLY for Linux Mint 22, AFAIK. Earlier Mint versions should work per the given instructions. It wouldn't hurt to watch the nice video to see the steps for yourself.

fantele commented 1 month ago

Since the problem only occurs with vosk installed via pipx but not if installed with pip3, you can just use a virtual environment. Create a new virtual environment, activate it and install vosk via pip3: python3 -m venv PATH-TO-NERD-DICTATION-VENV source PATH-TO-NERD-DICTATION-VENV/bin/activate pip3 install vosk deactivate

If you change the shebang in the first line of the nerd-dictation source code from #!/usr/bin/env python3 to #!PATH-TO-NERD-DICTATION-VENV/bin/python3, the program will always be executed in the virtual environment and should work as usual.