Fix uv pip install: use venv dir not python binary path, add .exe on Windows
Some checks failed
Build & Release / Build sidecar (x86_64-pc-windows-msvc) (push) Failing after 6s
Build & Release / Build app (x86_64-unknown-linux-gnu) (push) Has been cancelled
Build & Release / Build app (aarch64-apple-darwin) (push) Has been cancelled
Build & Release / Build sidecar (x86_64-unknown-linux-gnu) (push) Has been cancelled
Build & Release / Build app (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Release / Create Release (push) Has been cancelled
Build & Release / Build sidecar (aarch64-apple-darwin) (push) Has been cancelled
Some checks failed
Build & Release / Build sidecar (x86_64-pc-windows-msvc) (push) Failing after 6s
Build & Release / Build app (x86_64-unknown-linux-gnu) (push) Has been cancelled
Build & Release / Build app (aarch64-apple-darwin) (push) Has been cancelled
Build & Release / Build sidecar (x86_64-unknown-linux-gnu) (push) Has been cancelled
Build & Release / Build app (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Release / Create Release (push) Has been cancelled
Build & Release / Build sidecar (aarch64-apple-darwin) (push) Has been cancelled
- uv pip --python works better with the venv directory path than the python binary path (avoids "No virtual environment found" on Windows) - Add .exe suffix to Windows python path for non-uv fallback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -92,14 +92,18 @@ def create_venv_and_install(cpu_only: bool) -> Path:
|
||||
|
||||
# Determine python path inside venv
|
||||
if sys.platform == "win32":
|
||||
python = str(venv_dir / "Scripts" / "python")
|
||||
python = str(venv_dir / "Scripts" / "python.exe")
|
||||
else:
|
||||
python = str(venv_dir / "bin" / "python")
|
||||
|
||||
def pip_install(*args: str) -> None:
|
||||
"""Install packages. Pass package names and flags only, not 'install'."""
|
||||
if use_uv:
|
||||
subprocess.run(["uv", "pip", "install", "--python", python, *args], check=True)
|
||||
# Use --python with the venv directory (not the python binary) for uv
|
||||
subprocess.run(
|
||||
["uv", "pip", "install", "--python", str(venv_dir), *args],
|
||||
check=True,
|
||||
)
|
||||
else:
|
||||
subprocess.run([python, "-m", "pip", "install", *args], check=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user