Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not recording as a normal user, requires root #11

Open
ArjenR opened this issue Apr 23, 2024 · 8 comments
Open

Not recording as a normal user, requires root #11

ArjenR opened this issue Apr 23, 2024 · 8 comments

Comments

@ArjenR
Copy link
Contributor

ArjenR commented Apr 23, 2024

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
Copy link
Owner

ILikeAI commented Apr 24, 2024

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
Copy link
Contributor Author

ArjenR commented Apr 24, 2024

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
Copy link
Owner

ILikeAI commented Apr 24, 2024

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
Copy link
Contributor Author

ArjenR commented Apr 24, 2024

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
Copy link
Contributor Author

ArjenR commented Apr 24, 2024

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
Copy link

puccaso commented Apr 28, 2024

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
Copy link
Owner

ILikeAI commented May 4, 2024

Pynput is now used by default for non windows machines 😊

@ILikeAI
Copy link
Owner

ILikeAI commented May 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants