ILikeAI / AlwaysReddy

AlwaysReddy is a LLM voice assistant that is always just a hotkey away.
MIT License
621 stars 61 forks source link

Not recording as a normal user, requires root #11

Open ArjenR opened 5 months ago

ArjenR commented 5 months ago

When I start the program, it immediately stops with the following error: Failed to start the recorder: You must be root to use this library on linux.

I´d rather not run this as root. Sounddevice library can record as a normal user. How can I run this as a non-root user?

ILikeAI commented 5 months ago

Hmmm not sure whats going on here, I dont have a linux machine so its hard to test but let me look into it 👀

ArjenR commented 5 months ago

I did some debugging. It is when the hotkeys are set.

The keyboard module requires raw access to the input device and also for the user to be root (uid=0). See: Must be run as root under linux Also see: Python Keyboard Module doesn't work without root

Supposedly the pynput module can be used as a non-root user under X.

Edit: markdown formatting

ILikeAI commented 5 months ago

Ah this is super helpful thanks for looking into it. I just uninstalled diablo 4 so I have space to install ubuntu, as soon as I get some time ill set it up and see if I can get it sorted.

I think I originally used pynput for the hotkeys but swapped away for some reason, cant remember why though. Ill get testing when I can, let me know if you manage to come to any solutions on your side, feel free to make a PR if you do :)

ArjenR commented 5 months ago

Syntax of keyboard module for hotkeys looks to be more readable then pynput. Pynput does have hotkeys equivalent and on 1st glance it should be possible to replace it.

Maybe later I have time to fork and try and create a PR.

Personal opinion: If you are thinking about Ubuntu then you may find Pop!_OS based on Ubuntu LTS a developer friendly and usable snap-less alternative.

ArjenR commented 5 months ago

I think you switched because the tab and space keys cannot be used for hotkeys. Btw on linux Ctrl-Alt-F1-12 always will be captured by the graphical shell / kernel to switch console.

puccaso commented 5 months ago

hey folks,

getting the same issue here..

  torchaudio.set_audio_backend("soundfile")
Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.2.3. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../../../../.cache/torch/whisperx-vad-segmentation.bin`
Model was trained with pyannote.audio 0.0.1, yours is 3.1.1. Bad things might happen unless you revert pyannote.audio to 0.x.
Model was trained with torch 1.10.0+cu102, yours is 2.1.2+cu121. Bad things might happen unless you revert torch to 1.x.
Using WhisperX model: base and device: cpu
Failed to start the recorder: You must be root to use this library on linux.

will give the pynput a go

ILikeAI commented 5 months ago

Pynput is now used by default for non windows machines 😊

ILikeAI commented 4 months ago

I cant seem to get pynput to capture keyboard inputs globally on my ubuntu setup, has anyone else managed to get this to work? The app has to be in focus for it to detect