Skip to content

Commit

Permalink
fix: broken upgrade path for --break-system-packages users
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg committed Nov 5, 2024
1 parent d12a2db commit 35e63ba
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pikaraoke/karaoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,20 @@ def upgrade_youtubedl(self):
output = e.output.decode("utf8")
logging.info(output)
if "You installed yt-dlp with pip or using the wheel from PyPi" in output:
# allow pip to break system packages (probably required if installed without venv)
args = ["install", "--upgrade", "yt-dlp", "--break-system-packages"]
try:
logging.info("Attempting youtube-dl upgrade via pip3...")
output = check_output(["pip3", "install", "--upgrade", "yt-dlp"]).decode("utf8")
output = (
check_output(["pip3"] + args, stderr=subprocess.STDOUT).decode("utf8").strip()
)
except FileNotFoundError:
logging.info("Attempting youtube-dl upgrade via pip...")
output = check_output(["pip", "install", "--upgrade", "yt-dlp"]).decode("utf8")
logging.info(output)
output = (
check_output(["pip"] + args, stderr=subprocess.STDOUT).decode("utf8").strip()
)
self.get_youtubedl_version()

logging.info("Done. New version: %s" % self.youtubedl_version)

def is_network_connected(self):
Expand Down

0 comments on commit 35e63ba

Please sign in to comment.