fallback to regular pip install if uv pip fails
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 23 Sep 2024 19:13:48 +0000 (21:13 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 23 Sep 2024 19:16:59 +0000 (21:16 +0200)
music_assistant/server/helpers/util.py

index 82c2f3dba25b99fdc71fa8f7f229dd314dfde929..55c8439e80fc8b0494572f735e8412762d927499 100644 (file)
@@ -44,6 +44,20 @@ async def install_package(package: str) -> None:
     args = ["uv", "pip", "install", "--no-cache", "--find-links", HA_WHEELS, package]
     return_code, output = await check_output(*args)
 
+    if return_code != 0 and "Permission denied" in output.decode():
+        # try again with regular pip
+        # uv pip seems to have issues with permissions on docker installs
+        args = [
+            "pip",
+            "install",
+            "--no-cache-dir",
+            "--no-input",
+            "--find-links",
+            HA_WHEELS,
+            package,
+        ]
+        return_code, output = await check_output(*args)
+
     if return_code != 0:
         msg = f"Failed to install package {package}\n{output.decode()}"
         raise RuntimeError(msg)