Windows Git Bash install/setup issues: python3 alias + tito setup self-reinstall (proposed fix) #498

Open
opened 2026-03-22 15:44:19 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @adil-mubashir-ch on GitHub (Feb 6, 2026).

Hi Everyone!

I was setting up Tiny Torch on Windows through the quickstart guide (using Git Bash) and ran into some windows-specific issues that werent there when I used WSL. The issues stemmed from the install.sh and setup.py files and I did some local fixes and tested in windows and it seems to be working. Wanted to share that and ask how the best way to contribute that would be. I'll give more context and steps below:

Environment

  • OS: Windows 10
  • Shell: Git Bash (Git for Windows)
  • Python: Windows-native python.exe (3.13)
  • Install method: curl -sSL mlsysbook.ai/tinytorch/install.sh | bash

Issue 1: install.sh selects python3 on Windows Git Bash

This caused the creation Unix-style venvs (.venv/bin) instead of Windows (.venv/Scripts)

Fixed this by modifying the get_python_cmd() function to prefer python on Windows

# On Windows, prefer `python` over `python3` to avoid Microsoft Store aliases
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

Issue 2: tito setup attempts to reinstall the running CLI on Windows

tito setup currently runs: pip install -e .

This kept giving the error
WinError 32: The process cannot access the file because it is being used by another process:
....venv\Scripts\tito.exe

For this i made two changes

  1. In install.sh
    Added a marker file to indicate that tito installation is complete
    touch .tinytorch_installed

  2. In the setup.py
    On windows if this marker exists skip the installation in install_packages() function

project_root = self.config.project_root
install_marker = project_root / ".tinytorch_installed"
is_windows = platform.system() == "Windows"

if is_windows and install_marker.exists():
    self.console.print(
        "✅ Tiny🔥Torch already installed (skipping self-reinstall on Windows)"
    )
else:
    subprocess.run([sys.executable, "-m", "pip", "install", "-e", "."], ...)

How to Contribute the Change

I wanted to know how I could contribute and whether this approach seems appropriate for the issue. This is my first time contributing to an open source project so I hope this was the right way of discussing the issue. There was an issue that seems to be closed at the moment #1078 so I didnt post there. Hope that wasnt an problem. If The fixes seem fine I'd be happy to open a PR with these changes

Originally created by @adil-mubashir-ch on GitHub (Feb 6, 2026). Hi Everyone! I was setting up Tiny Torch on Windows through the quickstart guide (using Git Bash) and ran into some windows-specific issues that werent there when I used WSL. The issues stemmed from the install.sh and setup.py files and I did some local fixes and tested in windows and it seems to be working. Wanted to share that and ask how the best way to contribute that would be. I'll give more context and steps below: ### Environment - OS: Windows 10 - Shell: Git Bash (Git for Windows) - Python: Windows-native python.exe (3.13) - Install method: `curl -sSL mlsysbook.ai/tinytorch/install.sh | bash` ### Issue 1: install.sh selects python3 on Windows Git Bash This caused the creation Unix-style venvs (.venv/bin) instead of Windows (.venv/Scripts) Fixed this by modifying the **get_python_cmd()** function to prefer **python** on Windows ```python # On Windows, prefer `python` over `python3` to avoid Microsoft Store aliases 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 ``` ### Issue 2: tito setup attempts to reinstall the running CLI on Windows **tito setup** currently runs: pip install -e . This kept giving the error **WinError 32: The process cannot access the file because it is being used by another process: ...\.venv\Scripts\tito.exe** For this i made two changes 1. In **install.sh** Added a marker file to indicate that tito installation is complete `touch .tinytorch_installed` 2. In the setup.py On windows if this marker exists skip the installation in **install_packages()** function ```python project_root = self.config.project_root install_marker = project_root / ".tinytorch_installed" is_windows = platform.system() == "Windows" if is_windows and install_marker.exists(): self.console.print( "✅ Tiny🔥Torch already installed (skipping self-reinstall on Windows)" ) else: subprocess.run([sys.executable, "-m", "pip", "install", "-e", "."], ...) ``` ### How to Contribute the Change I wanted to know how I could contribute and whether this approach seems appropriate for the issue. This is my first time contributing to an open source project so I hope this was the right way of discussing the issue. There was an issue that seems to be closed at the moment #1078 so I didnt post there. Hope that wasnt an problem. If The fixes seem fine I'd be happy to open a PR with these changes
GiteaMirror added the type: bugarea: tinytorch labels 2026-03-22 15:44:19 -05:00
Author
Owner

@profvjreddi commented on GitHub (Feb 11, 2026):

Hi @adil-mubashir-ch — welcome, and great first contribution! Both issues are real and well-diagnosed. Here are some thoughts:

Issue 1: python3 alias on Windows Git Bash

Good catch. On Windows, python3 can resolve to the Microsoft Store alias stub instead of the actual Python executable, which then creates Unix-style venv paths. Your fix to prefer python on Windows in get_python_cmd() makes sense.

The installer already detects the platform via get_platform() and handles the venv activation path difference (lines 483–489), so the Python command selection is the missing piece.

Issue 2: tito.exe self-reinstall lock (WinError 32)

This is a classic Windows file-locking issue — you can't overwrite an executable that's currently running. Your diagnosis is correct.

However, the .tinytorch_installed marker file approach is a bit fragile (e.g., it persists even if the install is actually stale, and needs cleanup logic). A cleaner approach might be to skip the pip install -e . step in install_packages() when:

  1. We're on Windows, AND
  2. The TinyTorch package is already installed (we already have _check_package_installed() for this)

Something like:

# Skip self-reinstall on Windows if already installed (WinError 32 prevention)
is_windows = platform.system() == "Windows"
already_installed = self._check_package_installed("tinytorch")

if is_windows and already_installed:
    self.console.print("✅ Tiny🔥Torch already installed (skipping reinstall on Windows)")
else:
    # existing pip install -e . logic

This avoids the marker file entirely and uses the same package-checking pattern already in the codebase.

Next Steps

Please go ahead and open a PR! For the structure:

  • Issue 1 fix in site/extra/install.sh — your approach looks good as-is
  • Issue 2 fix in tito/commands/setup.py — consider the _check_package_installed() approach above instead of the marker file

Happy to review when it's ready. Thanks for taking the time to document this so thoroughly — really helpful for others hitting the same issue! 🙏

@profvjreddi commented on GitHub (Feb 11, 2026): Hi @adil-mubashir-ch — welcome, and great first contribution! Both issues are real and well-diagnosed. Here are some thoughts: ### Issue 1: `python3` alias on Windows Git Bash Good catch. On Windows, `python3` can resolve to the Microsoft Store alias stub instead of the actual Python executable, which then creates Unix-style venv paths. Your fix to prefer `python` on Windows in `get_python_cmd()` makes sense. The installer already detects the platform via `get_platform()` and handles the venv activation path difference (lines 483–489), so the Python command selection is the missing piece. ### Issue 2: `tito.exe` self-reinstall lock (`WinError 32`) This is a classic Windows file-locking issue — you can't overwrite an executable that's currently running. Your diagnosis is correct. However, the `.tinytorch_installed` marker file approach is a bit fragile (e.g., it persists even if the install is actually stale, and needs cleanup logic). A cleaner approach might be to skip the `pip install -e .` step in `install_packages()` when: 1. We're on Windows, AND 2. The TinyTorch package is already installed (we already have `_check_package_installed()` for this) Something like: ```python # Skip self-reinstall on Windows if already installed (WinError 32 prevention) is_windows = platform.system() == "Windows" already_installed = self._check_package_installed("tinytorch") if is_windows and already_installed: self.console.print("✅ Tiny🔥Torch already installed (skipping reinstall on Windows)") else: # existing pip install -e . logic ``` This avoids the marker file entirely and uses the same package-checking pattern already in the codebase. ### Next Steps Please go ahead and open a PR! For the structure: - Issue 1 fix in `site/extra/install.sh` — your approach looks good as-is - Issue 2 fix in `tito/commands/setup.py` — consider the `_check_package_installed()` approach above instead of the marker file Happy to review when it's ready. Thanks for taking the time to document this so thoroughly — really helpful for others hitting the same issue! 🙏
Author
Owner

@adil-mubashir-ch commented on GitHub (Feb 12, 2026):

Thank you for the comments @profvjreddi !

I’ve opened a PR with the recommended changes:
https://github.com/harvard-edge/cs249r_book/pull/1169

Glad to be able to contribute to this because I've been following the TinyML resources for several years now and finally got a chance to make a small contribution and give back! Happy to make any additional adjustments if needed.

@adil-mubashir-ch commented on GitHub (Feb 12, 2026): Thank you for the comments @profvjreddi ! I’ve opened a PR with the recommended changes: https://github.com/harvard-edge/cs249r_book/pull/1169 Glad to be able to contribute to this because I've been following the TinyML resources for several years now and finally got a chance to make a small contribution and give back! Happy to make any additional adjustments if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#498