TobKra96 / music_led_strip_control

Audio visualization for LED strips in real-time with web interface on a raspberry pi.
https://tobkra96.github.io/music_led_strip_control/
MIT License
305 stars 66 forks source link

MLSC is incompatible with Debian 12 Bookworm #204

Open makeitready opened 6 months ago

makeitready commented 6 months ago

Hi there, i get a failture while installing the MLSC software with the automatic installation. It sais "no module named coloredlogs" i already googled it but a fix lik "python -m pip install coloredlogs" does not help.

Pleas tell me what to do, tahnks a lot!

Putty Image: image

bug #install

Teraskull commented 6 months ago

Hi, thanks for the error log!

That does look strange and I will be testing the installer to see if I can replicate this.

Are you trying to install the master branch or dev_2.3? If master, please try reinstalling the newer branch:

curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/master/setup.sh | sudo bash -s -- -b dev_2.3

If the issue still happens, I guess there were some breaking changes from pip that enforce PEP 668 and now Raspberry Pi OS prevents mixing packages from apt and pip.

One solution would be for me to use a virtual environment in the installer. Hopefully this won't break a lot of things further down the line.

Thanks again! I'll get to this as soon as possible!

carlyd95 commented 6 months ago

Oh, dang I just posted a similar issue recently. Glad to see this.

So far the only thing I found to work is pip3 install -r req.txt --break-system-packages with req.txt being all the packages in requirements.txt without specified versions.

I am going to try the new branch that you mentioned above!

Thanks! @Teraskull

carlyd95 commented 6 months ago

Using curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/master/setup.sh | sudo bash -s -- -b dev_2.3 still yields the following

error: externally-managed-environment

× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.

Teraskull commented 6 months ago

Yea, it's preventing mixing apt and pip packages. I will test installing packages to a virtual environment to see if that works.

carlyd95 commented 6 months ago

@Teraskull I tried that with virtualenv but was unsuccessful. I hope you are able to find a work-around. :)

makeitready commented 6 months ago

I flashed the SD Card of my Rpi4 completely and installed Raspberry Pi OS again. This time i intstalled the dev_2.3 branch instead of the master branch as @Teraskull suggested.

But this time a get a Error "No module named pyaudio" Can you tell me what to do? I would like to use it next week 😆

Putty: image

thanks!

Teraskull commented 6 months ago

@carlyd95 @makeitready I noticed that Debian 12 Bookworm distros are now forcing installing pip packages into a venv, but I'm currently trying to figure out the root access for pip, since MLSC requires root access to the microphone device.

Until I test and update the setup script, I doubt that even manually creating a venv will help, since the installer expects to use the global python package location, which is not possible anymore with Debian 12.

Hopefully this will require minimum changes to the installation, but I'm glad that using venv is forced now, because previously the python/pip ecosystem managing was a mess.

Workaround while I fix the installer on the latest distro:

For now, your best option is to install the legacy Pi OS 11 Bullseye if you want to run MLSC as soon as possible, since that distro was tested and the installation script is confirmed to be working there. But I will try to make it work on the latest distro in the following days.

Thanks for your patience!

Teraskull commented 6 months ago

@carlyd95 @makeitready ,

Can you please try installing MLSC with this command?

curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/dev_2.3/setup.sh | sudo bash -s -- -b dev_2.3

Just pushed the script update to the dev_2.3 branch. The master branch won't work anyways because some Python modules there are too outdated for Python 3.11, so if all goes well, I will just merge the dev_2.3 branch into master and bump the versions in requirements.txt after more testing.

I did not test the script on a Pi OS 12, since I don't have a spare SD card at the moment, but it did work on an x64 Debian 12 VM, so assuming nothing else regarding the process changed, it should work. Including installing pre-built wheels for some modules.

I recommend deleting the whole /share directory so that the script does a fresh install:

sudo rm -r /share

Let me know if you have any issues, thanks!

makeitready commented 6 months ago

Hey there,

Your work-arround with the Bullseye OS works, thanks!

I also tried a new Install with Pi OS 64 Bit. I flashed the SD card and installed it with the command you posted above. Sadly, i have the same Errors like in my last post. Error "No module named pyaudio"

image

Thanks for all your work.

@carlyd95 @makeitready ,

Can you please try installing MLSC with this command?

curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/dev_2.3/setup.sh | sudo bash -s -- -b dev_2.3

Just pushed the script update to the dev_2.3 branch. The master branch won't work anyways because some Python modules there are too outdated for Python 3.11, so if all goes well, I will just merge the dev_2.3 branch into master and bump the versions in requirements.txt after more testing.

I did not test the script on a Pi OS 12, since I don't have a spare SD card at the moment, but it did work on an x64 Debian 12 VM, so assuming nothing else regarding the process changed, it should work. Including installing pre-built wheels for some modules.

I recommend deleting the whole /share directory so that the script does a fresh install:

sudo rm -r /share

Let me know if you have any issues, thanks!

Teraskull commented 6 months ago

Hi @makeitready ,

Can you try running it like this, inside /share/music_led_strip_control/server?

sudo /share/venv/bin/python3 main.py

Since now a virtual environment is used, the Python executable should be from that venv.

You can call it like /share/venv/bin/python3, or you can temporarily make the venv Python the main one, by activating the virtual environment:

source /share/venv/bin/activate
makeitready commented 6 months ago

Hi @Teraskull

The installation with a RPI 4 and PI OS 64 Bit works with

curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/dev_2.3/setup.sh | sudo bash -s -- -b dev_2.3

and

sudo /share/venv/bin/python3 main.py

But now the service dhcpcd does not work. Error "dhcp.serice not found"

image

So the WiFi Network does not appear...

Teraskull commented 6 months ago

Hey @makeitready ,

Turns out Debian Bookworm replaced dhcpcd with NetworkManager, and there is no easy way to get dhcpcd running on it without breaking stuff.

They also replaced Alsa with PipeWire, so that change will break the music effects and microphone detection too.

I guess, for now the best option is to use Debian Bullseye, because there are too many breaking changes in the new OS.

Unfortunately, I do not have time or the possibility to test Bookworm on a Pi now, and I have no idea how to migrate the network and microphone configurations to support NetworkManager/PipeWire. I think a lot of software will have problems with the Bullseye -> Bookworm upgrade too.

Thanks for your issue reports and support!