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

[BUG] pikaraoke fails to start if new yt-dlp is released and --break-system-packages is used to install pikaraoke #402

Closed
Romeo1984 opened this issue Sep 30, 2024 · 6 comments

Comments

@Romeo1984
Copy link

Romeo1984 commented Sep 30, 2024

Describe the bug
I have this system running well using a systemd service to start pikaraoke in kiosk mode. To do this, I had to install with --break-system-packages. Today when I turned the system on, pikaraoke failed to start because there is a new version of yt-dlp release three days ago.

To Reproduce
Steps to reproduce the behavior:

  1. Intstall Pikaraoke with the --break-system-packages option.
  2. downgrade or install an old version of yt-dlp: pip install --upgrade yt-dlp==2024.08.06
  3. Try to start pikaroke
  4. Observe the error:

Sep 30 16:24:56 pikaraoke pikaraoke[978]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 30 16:24:56 pikaraoke pikaraoke[978]: File "/usr/lib/python3.11/subprocess.py", line 466, in check_output Sep 30 16:24:56 pikaraoke pikaraoke[978]: return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, Sep 30 16:24:56 pikaraoke pikaraoke[978]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 30 16:24:56 pikaraoke pikaraoke[978]: File "/usr/lib/python3.11/subprocess.py", line 571, in run Sep 30 16:24:56 pikaraoke pikaraoke[978]: raise CalledProcessError(retcode, process.args, Sep 30 16:24:56 pikaraoke pikaraoke[978]: subprocess.CalledProcessError: Command '['pip3', 'install', '--upgrade', 'yt-dlp']' returned non-zero exit status 1.

I had to run pip3 install --upgrade yt-dlp --break-system-packages to fix. Then rebooted the system to bring back pikaraoke.

Expected behavior
yt-dlp would be upgraded normally. OR pikaraoke would start normally and let me upgrade yt-dlp on my own. The old version still works (this time).

Screenshots
None.

Platform (please complete the following information):
Platform: Raspberry Pi 4 Model B Rev 1.5
OS Version: #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07)
Youtube-dl (yt-dlp) version: 2024.08.06
FFmpeg version: 5.1.6-0+deb12u1+rpt1
Pikaraoke version: 1.5.0

Additional context
None,

@Romeo1984
Copy link
Author

Romeo1984 commented Oct 3, 2024

I decided to tackle the systemd service to start the pikaraoke in the python venv. I created a new instance based on the Linux Python venv instructions on the Readme page - no longer using the --break-system-packages option. Notice that you don't need to stipulate the yt-dlp path anymore. I verify that yt-dlp automatic upgrade works.

[Unit]
Description=pikaraoke
After=multi-user.target

[Service]
WorkingDirectory=/home/pi/.venv/
Type=simple
ExecStart=/home/pi/.venv/bin/python /home/pi/.venv/bin/pikaraoke --headless --download-path /home/pi/pikaraoke-songs --volume 0.75 --high-quality
User=pi
Group=pi
Environment="PATH=$PATH:/home/pi/.venv/bin:/home/pi/.venv/lib/python3.11/site-packages:/usr/bin:/usr/sbin"
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

@BentWrench
Copy link

BentWrench commented Oct 27, 2024

Same exact issue and I will use your fix of using venv to setup Pi Karaoke. I assume anyone else using the --break-system-packages option will experience the same issue the next time they need an update. I don't have this issue on my second Pi where I installed yt-dlp system-wide, it updates fine, even though I installed Pi Karaoke using --break-system-packages.

I am wondering though, with your fix of pip3 install --upgrade yt-dlp --break-system-packages if it would update automaticallly the next time without issue.

@vicwomg
Copy link
Owner

vicwomg commented Nov 5, 2024

Obviously the app should launch regardless, and we should handle the error properly. But I'm a bit torn on the options:

simply tacking on --break-system-packages to the subprocess command in the code fixes it

  • It's a one-line fix, and just works
  • I don't believe this will adversely affect venv installs, since those will just continue updating their local packages, despite the flag.
  • Though I could be wrong, does anyone know if specifying break-system-packages will force pip to install globally while in a venv?
  • Technically "break-system-packages" is a dire warning and might need to be taken seriously?
  • On the other hand, I don't actually think it matters at all in this case, why wouldn't you just update youtube-dl globally? Who cares?
  • Maybe there's some sub dependencies of youtube-dl that could also update and break other programs?
  • Argh, python package management still suuucks

Other option is to allow breaking system packages with YET ANOTHER flag to pikaraoke. Which also sucks.

Maybe this is up to the individual user to fix, via venv or other configuration. Apparently, you can set an env variable which will allow breaking of system packages globally:
PIP_BREAK_SYSTEM_PACKAGES=1
Source: https://veronneau.org/python-311-pip-and-breaking-system-packages.html

@vicwomg
Copy link
Owner

vicwomg commented Nov 5, 2024

I have confirmed that running export PIP_BREAK_SYSTEM_PACKAGES=1 before pikaraoke also fixes the issue. That's also relatively simple, but requires some extra config ¯_(ツ)_/¯

@vicwomg
Copy link
Owner

vicwomg commented Nov 5, 2024

After too much deliberation, I don't see a problem with the simplest option: adding the --break-system-packages flag in. For venv users, no ill effect. For global python users, it will fix the issue. They installed it one way or the other

https://github.com/vicwomg/pikaraoke/pull/417/files

@vicwomg
Copy link
Owner

vicwomg commented Nov 5, 2024

@vicwomg vicwomg closed this as completed Nov 5, 2024
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