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

Running with root possible? #143

Open
janfiess opened this issue Aug 11, 2021 · 3 comments
Open

Running with root possible? #143

janfiess opened this issue Aug 11, 2021 · 3 comments

Comments

@janfiess
Copy link

I need to run python-osc together with the rpi_ws281x module (Adafruit library for running addressable LED pixels).
For running that library I need root
However, if I use root with python-osc, the module will not be found. Is there any solution.
I found similar issues, but the did not work for me.

@dvzrv
Copy link

dvzrv commented Aug 11, 2021

How (and as which user) did you install python-osc on the host?
If you did not install it system-wide (e.g. to /usr/lib/python3.9/site-packages/ - the location may be different on your distribution!) root will not be able to access the module.

@janfiess
Copy link
Author

Ah this helped! Thanks man! I installed it again with sudo pip3 install, then it appeared!

@dvzrv
Copy link

dvzrv commented Aug 13, 2021

@janfiess do note, that using sudo pip is never a good idea though.

It will install to the system-wide location, but it will also lead to this (language package manager based) installation conflicting with any system package provided files (when on Debian this might not be the case as they heavily patch pip to work different from the upstream suggestions, ie. by installing to /usr/local/lib/python3.9/). This will lead to conflicts and broken setups on nearly all Linux distributions.

The ideal way is to either rely on a system package management provided package (if available), or to fix the setup you are using to allow running the code as an unprivileged user (from a security perspective the latter is always preferable).

Looking at the documentation of the rpi_ws281x package it states clearly:

SPI requires you to be in the gpio group if you wish to control your LEDs without root.

You do not need root to run your code, but you need to add your user to the gpio group (I assume this applies to Debian). If in doubt check the ownership on the device node that you want to communicate with.

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

2 participants