From f2975daa67f0e08efd5747bf4ae87590d662a0c2 Mon Sep 17 00:00:00 2001 From: Adil Mubashir Chaudhry <75829014+Heuscartist@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:47:35 +0500 Subject: [PATCH] Fix Windows install issues - Prefer python over python3 in Git Bash to avoid Microsoft Store alias and incorrect venv paths - Skip TinyTorch self-reinstall on Windows if already installed (prevents WinError 32 file lock) --- tinytorch/site/extra/install.sh | 12 ++++++-- tinytorch/tito/commands/setup.py | 50 +++++++++++++++++++------------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/tinytorch/site/extra/install.sh b/tinytorch/site/extra/install.sh index 9255a28e6..27c665814 100755 --- a/tinytorch/site/extra/install.sh +++ b/tinytorch/site/extra/install.sh @@ -205,9 +205,17 @@ check_python_version() { # Find the best Python command (prioritize newer versions) get_python_cmd() { + local platform + platform=$(get_platform) + # Check specific versions first, prioritizing newer versions - local candidates=("python3.13" "python3.12" "python3.11" "python3.10" "python3.9" "python3.8" "python3" "python") - + # FIX: windows to fix microsoft store alis stuf + if [ "$platform" = "windows" ]; then + local candidates=("python") + else + local candidates=("python3.13" "python3.12" "python3.11" "python3.10" "python3.9" "python3.8" "python3" "python") + fi + for cmd in "${candidates[@]}"; do if command_exists "$cmd"; then # Verify this specific candidate actually meets the version requirement diff --git a/tinytorch/tito/commands/setup.py b/tinytorch/tito/commands/setup.py index cc60d17c8..2be3a9847 100644 --- a/tinytorch/tito/commands/setup.py +++ b/tinytorch/tito/commands/setup.py @@ -128,6 +128,10 @@ class SetupCommand(BaseCommand): def install_packages(self) -> bool: """Install required packages for Tiny🔥Torch development.""" + + # FIX: Windows Specific flags + is_windows = platform.system() == "Windows" + # Essential packages for TinyTorch packages = [ ("numpy", "numpy>=1.21.0"), @@ -196,30 +200,36 @@ class SetupCommand(BaseCommand): return False # Install Tiny🔥Torch in development mode - with Progress( - SpinnerColumn(), - TextColumn("[progress.description]{task.description}"), - console=self.console - ) as progress: - task = progress.add_task("Installing Tiny🔥Torch in development mode...", total=None) + # FIX: Skip installation on windows + if is_windows and self._check_package_installed("tinytorch"): + self.console.print( + "[green]✅ Tiny🔥Torch already installed (skipping reinstall on Windows)[/green]" + ) + else: + with Progress( + SpinnerColumn(), + TextColumn("[progress.description]{task.description}"), + console=self.console + ) as progress: + task = progress.add_task("Installing Tiny🔥Torch in development mode...", total=None) - try: - result = subprocess.run([ - sys.executable, "-m", "pip", "install", "-q", "-e", "." - ], cwd=self.config.project_root, capture_output=True, text=True, timeout=120) + try: + result = subprocess.run([ + sys.executable, "-m", "pip", "install", "-q", "-e", "." + ], cwd=self.config.project_root, capture_output=True, text=True, timeout=120) - if result.returncode == 0: - progress.update(task, description="[green]✅ Tiny🔥Torch installed[/green]") - else: - progress.update(task, description="[red]❌ Tiny🔥Torch install failed[/red]") - self.console.print(f"[red]Failed to install Tiny🔥Torch: {result.stderr}[/red]") + if result.returncode == 0: + progress.update(task, description="[green]✅ Tiny🔥Torch installed[/green]") + else: + progress.update(task, description="[red]❌ Tiny🔥Torch install failed[/red]") + self.console.print(f"[red]Failed to install Tiny🔥Torch: {result.stderr}[/red]") + return False + + except Exception as e: + progress.update(task, description="[red]❌ Tiny🔥Torch error[/red]") + self.console.print(f"[red]Error installing Tiny🔥Torch: {e}[/red]") return False - except Exception as e: - progress.update(task, description="[red]❌ Tiny🔥Torch error[/red]") - self.console.print(f"[red]Error installing Tiny🔥Torch: {e}[/red]") - return False - # Register Jupyter kernel so notebooks use this Python environment self.console.print() self.console.print("[bold]Registering Jupyter kernel...[/bold]")